Implemented deselecting game
This commit is contained in:
@@ -38,9 +38,7 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.arrow_back_ios),
|
||||
onPressed: () {
|
||||
Navigator.of(
|
||||
context,
|
||||
).pop(selectedGameIndex == -1 ? null : selectedGameIndex);
|
||||
Navigator.of(context).pop(selectedGameIndex);
|
||||
},
|
||||
),
|
||||
title: const Text(
|
||||
@@ -70,7 +68,11 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
||||
isHighlighted: selectedGameIndex == index,
|
||||
onPressed: () async {
|
||||
setState(() {
|
||||
if (selectedGameIndex == index) {
|
||||
selectedGameIndex = -1;
|
||||
} else {
|
||||
selectedGameIndex = index;
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
@@ -148,11 +148,14 @@ class _CreateGameViewState extends State<CreateGameView> {
|
||||
),
|
||||
),
|
||||
);
|
||||
if (selectedGameIndex != -1) {
|
||||
setState(() {
|
||||
selectedRuleset = games[selectedGameIndex].$3;
|
||||
selectedRulesetIndex = rulesets.indexWhere(
|
||||
(r) => r.$1 == selectedRuleset,
|
||||
);
|
||||
setState(() {});
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
ChooseTile(
|
||||
|
||||
Reference in New Issue
Block a user