Merge ef9b3ae698 into 74949e0861
This commit is contained in:
commit
f8ed9e6e93
|
|
@ -16,6 +16,7 @@ class OperatingSystemSelection extends StatefulWidget {
|
|||
class _OperatingSystemSelectionState extends State<OperatingSystemSelection> {
|
||||
var term = "";
|
||||
final focusNode = FocusNode();
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
@ -23,6 +24,12 @@ class _OperatingSystemSelectionState extends State<OperatingSystemSelection> {
|
|||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_scrollController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
|
|
@ -63,64 +70,56 @@ class _OperatingSystemSelectionState extends State<OperatingSystemSelection> {
|
|||
),
|
||||
),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
FutureBuilder(
|
||||
future: gOperatingSystems,
|
||||
builder: (BuildContext context, AsyncSnapshot<List> snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
List list = snapshot.data!
|
||||
.where((os) => os.name.toLowerCase().contains(term.toLowerCase()))
|
||||
.toList();
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
shrinkWrap: true,
|
||||
itemCount: list.length,
|
||||
itemBuilder: (context, index) {
|
||||
var item = list[index];
|
||||
Widget icon;
|
||||
body: Scrollbar(
|
||||
controller: _scrollController,
|
||||
child: FutureBuilder(
|
||||
future: gOperatingSystems,
|
||||
builder: (BuildContext context, AsyncSnapshot<List> snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
List list = snapshot.data!
|
||||
.where((os) =>
|
||||
os.name.toLowerCase().contains(term.toLowerCase()))
|
||||
.toList();
|
||||
return ListView.builder(
|
||||
controller: _scrollController,
|
||||
itemCount: list.length,
|
||||
itemBuilder: (context, index) {
|
||||
var item = list[index];
|
||||
Widget icon;
|
||||
|
||||
if (osIcons.containsKey(item.code)) {
|
||||
icon = SvgPicture.asset(
|
||||
osIcons[item.code]!,
|
||||
width: 32,
|
||||
height: 32,
|
||||
);
|
||||
} else {
|
||||
// Replace with generic icon
|
||||
icon = const Icon(Icons.computer, size: 32);
|
||||
}
|
||||
return Card(
|
||||
child: ListTile(
|
||||
title: Text(item.name),
|
||||
leading: icon,
|
||||
onTap: () {
|
||||
Navigator.of(context).pop(item);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
if (osIcons.containsKey(item.code)) {
|
||||
icon = SvgPicture.asset(
|
||||
osIcons[item.code]!,
|
||||
width: 32,
|
||||
height: 32,
|
||||
);
|
||||
} else {
|
||||
icon = const Icon(Icons.computer, size: 32);
|
||||
}
|
||||
return Card(
|
||||
child: ListTile(
|
||||
title: Text(item.name),
|
||||
leading: icon,
|
||||
onTap: () {
|
||||
Navigator.of(context).pop(item);
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: CircularProgressIndicator()
|
||||
),
|
||||
Text(context.t('Loading available downloads')),
|
||||
],
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
),
|
||||
]
|
||||
},
|
||||
);
|
||||
} else {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(height: 16),
|
||||
Text(context.t('Loading available downloads')),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ class OptionSelection extends StatefulWidget {
|
|||
class _OptionSelectionState extends State<OptionSelection> {
|
||||
var term = "";
|
||||
final focusNode = FocusNode();
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
@ -22,6 +23,12 @@ class _OptionSelectionState extends State<OptionSelection> {
|
|||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_scrollController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var list = widget.version.options
|
||||
|
|
@ -68,25 +75,22 @@ class _OptionSelectionState extends State<OptionSelection> {
|
|||
),
|
||||
),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: list.length,
|
||||
itemBuilder: (context, index) {
|
||||
var item = list[index];
|
||||
return Card(
|
||||
child: ListTile(
|
||||
title: Text(item.option),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop(item);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
body: Scrollbar(
|
||||
controller: _scrollController,
|
||||
child: ListView.builder(
|
||||
controller: _scrollController,
|
||||
itemCount: list.length,
|
||||
itemBuilder: (context, index) {
|
||||
var item = list[index];
|
||||
return Card(
|
||||
child: ListTile(
|
||||
title: Text(item.option),
|
||||
onTap: () {
|
||||
Navigator.of(context).pop(item);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ class VersionSelection extends StatefulWidget {
|
|||
class _VersionSelectionState extends State<VersionSelection> {
|
||||
var term = "";
|
||||
final focusNode = FocusNode();
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
|
@ -26,6 +27,12 @@ class _VersionSelectionState extends State<VersionSelection> {
|
|||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_scrollController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var list = widget.operatingSystem.versions
|
||||
|
|
@ -73,41 +80,37 @@ class _VersionSelectionState extends State<VersionSelection> {
|
|||
),
|
||||
),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
ListView.builder(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
shrinkWrap: true,
|
||||
itemCount: list.length,
|
||||
itemBuilder: (context, index) {
|
||||
var item = list[index];
|
||||
return Card(
|
||||
child: ListTile(
|
||||
title: Text(item.version),
|
||||
onTap: () {
|
||||
if (item.options.length > 1) {
|
||||
body: Scrollbar(
|
||||
controller: _scrollController,
|
||||
child: ListView.builder(
|
||||
controller: _scrollController,
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
itemCount: list.length,
|
||||
itemBuilder: (context, index) {
|
||||
var item = list[index];
|
||||
return Card(
|
||||
child: ListTile(
|
||||
title: Text(item.version),
|
||||
onTap: () {
|
||||
if (item.options.length > 1) {
|
||||
Navigator.of(context)
|
||||
.push<Option>(MaterialPageRoute(
|
||||
fullscreenDialog: true,
|
||||
builder: (context) => OptionSelection(list[index])))
|
||||
.then((selection) {
|
||||
if (selection != null) {
|
||||
Navigator.of(context)
|
||||
.push<Option>(MaterialPageRoute(
|
||||
fullscreenDialog: true,
|
||||
builder: (context) =>
|
||||
OptionSelection(list[index])))
|
||||
.then((selection) {
|
||||
if (selection != null) {
|
||||
Navigator.of(context)
|
||||
.pop(Tuple2<Version, Option?>(item, selection));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Navigator.of(context).pop(Tuple2<Version, Option?>(
|
||||
item, list[index].options[0]));
|
||||
.pop(Tuple2<Version, Option?>(item, selection));
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
});
|
||||
} else {
|
||||
Navigator.of(context).pop(
|
||||
Tuple2<Version, Option?>(item, list[index].options[0]));
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue