revert: WillPopScope migration

This reverts commit ef9b1d5c2d.

Why is this so hard to implement??? Are we missing something??
This commit is contained in:
Pun Butrach
2024-02-15 08:00:52 +00:00
committed by GitHub
parent 31a32eb11d
commit 3b0fed55e4
3 changed files with 17 additions and 9 deletions

View File

@ -13,10 +13,14 @@ class NavigationView extends StatelessWidget {
return ViewModelBuilder<NavigationViewModel>.reactive(
onViewModelReady: (model) => model.initialize(context),
viewModelBuilder: () => locator<NavigationViewModel>(),
builder: (context, model, child) => PopScope(
canPop: model.currentIndex == 0,
onPopInvoked: (bool didPop) => {
if (!didPop) model.setIndex(0),
builder: (context, model, child) => WillPopScope(
onWillPop: () async {
if (model.currentIndex == 0) {
return true;
} else {
model.setIndex(0);
return false;
}
},
child: Scaffold(
body: PageTransitionSwitcher(