fix choose rulset & choose group view not saving

This commit is contained in:
2026-01-03 11:02:38 +01:00
parent e4ae526d93
commit 16e1f542f5
2 changed files with 101 additions and 69 deletions

View File

@@ -57,7 +57,23 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
),
centerTitle: true,
),
body: Column(
body: PopScope(
// This fixes that the Android Back Gesture didn't return the
// selectedGroupId and therefore the selected Group wasn't saved
canPop: false,
onPopInvokedWithResult: (bool didPop, Object? result) {
if (didPop) {
return;
}
Navigator.of(context).pop(
selectedGroupId == ''
? null
: widget.groups.firstWhere(
(group) => group.id == selectedGroupId,
),
);
},
child: Column(
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
@@ -113,6 +129,7 @@ class _ChooseGroupViewState extends State<ChooseGroupView> {
),
],
),
),
);
}

View File

@@ -52,7 +52,21 @@ class _ChooseRulesetViewState extends State<ChooseRulesetView> {
),
centerTitle: true,
),
body: ListView.builder(
body: PopScope(
// This fixes that the Android Back Gesture didn't return the
// selectedRulesetIndex and therefore the selected Ruleset wasn't saved
canPop: false,
onPopInvokedWithResult: (bool didPop, Object? result) {
if (didPop) {
return;
}
Navigator.of(context).pop(
selectedRulesetIndex == -1
? null
: widget.rulesets[selectedRulesetIndex].$1,
);
},
child: ListView.builder(
padding: const EdgeInsets.only(bottom: 85),
itemCount: widget.rulesets.length,
itemBuilder: (BuildContext context, int index) {
@@ -73,6 +87,7 @@ class _ChooseRulesetViewState extends State<ChooseRulesetView> {
},
),
),
),
);
}
}