We use this to handle back navigation for our bottom navigation
drawer manually, something which we might want to revisit in the
future in general, but for now just replace this with a
non-depreacted variant.
There set canPop to false to disable the auto-pop of the framework
and handle popping then manually.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
dispose: (context, bloc) => bloc.dispose(),
)
],
- child: WillPopScope(
- onWillPop: () async {
- if (pageSelector.value != 0) {
- pageSelector.add(0);
- return false;
+ child: PopScope(
+ canPop: false,
+ onPopInvoked: (didPop) async {
+ if (didPop || pageSelector.value != 0) {
+ if (pageSelector.value != 0) pageSelector.add(0);
+ return;
}
- return true;
+ if (mounted) Navigator.of(context).pop();
},
child: StreamBuilder<int>(
stream: pageSelector.stream,