fix choose_game_view not saving
This commit is contained in:
@@ -47,39 +47,50 @@ class _ChooseGameViewState extends State<ChooseGameView> {
|
|||||||
),
|
),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
),
|
),
|
||||||
body: Column(
|
body: PopScope(
|
||||||
children: [
|
canPop: false,
|
||||||
Padding(
|
onPopInvokedWithResult: (bool didPop, Object? result) {
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
print(result);
|
||||||
child: CustomSearchBar(
|
print(didPop);
|
||||||
controller: searchBarController,
|
if (didPop) {
|
||||||
hintText: 'Game Name',
|
return;
|
||||||
|
}
|
||||||
|
Navigator.of(context).pop(selectedGameIndex);
|
||||||
|
},
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||||
|
child: CustomSearchBar(
|
||||||
|
controller: searchBarController,
|
||||||
|
hintText: 'Game Name',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 5),
|
||||||
const SizedBox(height: 5),
|
Expanded(
|
||||||
Expanded(
|
child: ListView.builder(
|
||||||
child: ListView.builder(
|
itemCount: widget.games.length,
|
||||||
itemCount: widget.games.length,
|
itemBuilder: (BuildContext context, int index) {
|
||||||
itemBuilder: (BuildContext context, int index) {
|
return TitleDescriptionListTile(
|
||||||
return TitleDescriptionListTile(
|
title: widget.games[index].$1,
|
||||||
title: widget.games[index].$1,
|
description: widget.games[index].$2,
|
||||||
description: widget.games[index].$2,
|
badgeText: translateRulesetToString(widget.games[index].$3),
|
||||||
badgeText: translateRulesetToString(widget.games[index].$3),
|
isHighlighted: selectedGameIndex == index,
|
||||||
isHighlighted: selectedGameIndex == index,
|
onPressed: () async {
|
||||||
onPressed: () async {
|
setState(() {
|
||||||
setState(() {
|
if (selectedGameIndex == index) {
|
||||||
if (selectedGameIndex == index) {
|
selectedGameIndex = -1;
|
||||||
selectedGameIndex = -1;
|
} else {
|
||||||
} else {
|
selectedGameIndex = index;
|
||||||
selectedGameIndex = index;
|
}
|
||||||
}
|
});
|
||||||
});
|
},
|
||||||
},
|
);
|
||||||
);
|
},
|
||||||
},
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user