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...'),
|
||||
onPressed: () {
|
||||
Navigator.of(context)
|
||||
.push<OperatingSystem>(MaterialPageRoute(fullscreenDialog: true, builder: (context) => const OperatingSystemSelection()))
|
||||
.push<OperatingSystem>(MaterialPageRoute(
|
||||
fullscreenDialog: true,
|
||||
builder: (context) => const OperatingSystemSelection()))
|
||||
.then((selection) {
|
||||
if (selection != null) {
|
||||
setState(() {
|
||||
_selectedOperatingSystem = selection;
|
||||
_selectedVersion = null;
|
||||
_selectedOption = null;
|
||||
if (selection.versions.length == 1 &&
|
||||
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