mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
refactor: Replace deprecated WillPopScope
(#1604)
This commit is contained in:
parent
fd2780624a
commit
ef9b1d5c2d
@ -595,8 +595,8 @@ class ManagerAPI {
|
|||||||
return showDialog(
|
return showDialog(
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
context: context,
|
context: context,
|
||||||
builder: (context) => WillPopScope(
|
builder: (context) => PopScope(
|
||||||
onWillPop: () async => false,
|
canPop: false,
|
||||||
child: AlertDialog(
|
child: AlertDialog(
|
||||||
title: I18nText('warning'),
|
title: I18nText('warning'),
|
||||||
content: ValueListenableBuilder(
|
content: ValueListenableBuilder(
|
||||||
|
@ -15,7 +15,7 @@ class InstallerView extends StatelessWidget {
|
|||||||
return ViewModelBuilder<InstallerViewModel>.reactive(
|
return ViewModelBuilder<InstallerViewModel>.reactive(
|
||||||
onViewModelReady: (model) => model.initialize(context),
|
onViewModelReady: (model) => model.initialize(context),
|
||||||
viewModelBuilder: () => InstallerViewModel(),
|
viewModelBuilder: () => InstallerViewModel(),
|
||||||
builder: (context, model, child) => WillPopScope(
|
builder: (context, model, child) => PopScope(
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
top: false,
|
top: false,
|
||||||
bottom: model.isPatching,
|
bottom: model.isPatching,
|
||||||
@ -111,7 +111,7 @@ class InstallerView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
onWillPop: () => model.onWillPop(context),
|
onPopInvoked: (bool didPop) => model.onWillPop(context),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -13,14 +13,10 @@ class NavigationView extends StatelessWidget {
|
|||||||
return ViewModelBuilder<NavigationViewModel>.reactive(
|
return ViewModelBuilder<NavigationViewModel>.reactive(
|
||||||
onViewModelReady: (model) => model.initialize(context),
|
onViewModelReady: (model) => model.initialize(context),
|
||||||
viewModelBuilder: () => locator<NavigationViewModel>(),
|
viewModelBuilder: () => locator<NavigationViewModel>(),
|
||||||
builder: (context, model, child) => WillPopScope(
|
builder: (context, model, child) => PopScope(
|
||||||
onWillPop: () async {
|
canPop: model.currentIndex == 0,
|
||||||
if (model.currentIndex == 0) {
|
onPopInvoked: (bool didPop) => {
|
||||||
return true;
|
if (!didPop) model.setIndex(0),
|
||||||
} else {
|
|
||||||
model.setIndex(0);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
body: PageTransitionSwitcher(
|
body: PageTransitionSwitcher(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user