diff --git a/lib/services/manager_api.dart b/lib/services/manager_api.dart index 17072b0417..c371d6b546 100644 --- a/lib/services/manager_api.dart +++ b/lib/services/manager_api.dart @@ -582,8 +582,8 @@ class ManagerAPI { return showDialog( barrierDismissible: false, context: context, - builder: (context) => WillPopScope( - onWillPop: () async => false, + builder: (context) => PopScope( + canPop: false, child: AlertDialog( title: I18nText('warning'), content: ValueListenableBuilder( diff --git a/lib/ui/views/installer/installer_view.dart b/lib/ui/views/installer/installer_view.dart index d1626ed5ab..589021bfb6 100644 --- a/lib/ui/views/installer/installer_view.dart +++ b/lib/ui/views/installer/installer_view.dart @@ -15,7 +15,7 @@ class InstallerView extends StatelessWidget { return ViewModelBuilder.reactive( onViewModelReady: (model) => model.initialize(context), viewModelBuilder: () => InstallerViewModel(), - builder: (context, model, child) => WillPopScope( + builder: (context, model, child) => PopScope( child: SafeArea( top: false, bottom: model.isPatching, @@ -111,7 +111,7 @@ class InstallerView extends StatelessWidget { ), ), ), - onWillPop: () => model.onWillPop(context), + onPopInvoked: (bool didPop) => model.onWillPop(context), ), ); } diff --git a/lib/ui/views/navigation/navigation_view.dart b/lib/ui/views/navigation/navigation_view.dart index 13a4457e22..5eb6926ae7 100644 --- a/lib/ui/views/navigation/navigation_view.dart +++ b/lib/ui/views/navigation/navigation_view.dart @@ -13,14 +13,10 @@ class NavigationView extends StatelessWidget { return ViewModelBuilder.reactive( onViewModelReady: (model) => model.initialize(context), viewModelBuilder: () => locator(), - builder: (context, model, child) => WillPopScope( - onWillPop: () async { - if (model.currentIndex == 0) { - return true; - } else { - model.setIndex(0); - return false; - } + builder: (context, model, child) => PopScope( + canPop: model.currentIndex == 0, + onPopInvoked: (bool didPop) => { + if (!didPop) model.setIndex(0), }, child: Scaffold( body: PageTransitionSwitcher(