Preselect the version when only one version is available (#19)
e.g. Arch Linux only has `latest` available. We can preselect `latest` in this instance.
This commit is contained in:
parent
5ddb7f80e2
commit
a8cb368f94
|
|
@ -37,13 +37,21 @@ class _HomePageButtonGroupState extends State<HomePageButtonGroup> {
|
||||||
text: _selectedOperatingSystem?.name ?? context.t('Select...'),
|
text: _selectedOperatingSystem?.name ?? context.t('Select...'),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
.push<OperatingSystem>(MaterialPageRoute(fullscreenDialog: true, builder: (context) => const OperatingSystemSelection()))
|
.push<OperatingSystem>(MaterialPageRoute(
|
||||||
|
fullscreenDialog: true,
|
||||||
|
builder: (context) => const OperatingSystemSelection()))
|
||||||
.then((selection) {
|
.then((selection) {
|
||||||
if (selection != null) {
|
if (selection != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_selectedOperatingSystem = selection;
|
_selectedOperatingSystem = selection;
|
||||||
_selectedVersion = null;
|
if (selection.versions.length == 1 &&
|
||||||
_selectedOption = null;
|
selection.versions.first.options.length == 1) {
|
||||||
|
_selectedVersion = selection.versions.first;
|
||||||
|
_selectedOption = selection.versions.first.options.first;
|
||||||
|
} else {
|
||||||
|
_selectedVersion = null;
|
||||||
|
_selectedOption = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue