refactor: PopScope Migration (#1674)

Co-authored-by: Benjamin Halko <benjaminhalko@hotmail.com>
This commit is contained in:
Pun Butrach
2024-02-18 08:32:32 +07:00
committed by GitHub
parent f5ba84d81e
commit 3b58d229da
4 changed files with 28 additions and 30 deletions

View File

@ -526,25 +526,23 @@ class InstallerViewModel extends BaseViewModel {
}
}
Future<bool> onWillPop(BuildContext context) async {
if (isPatching) {
if (!cancel) {
cancel = true;
_toast.showBottom(t.installerView.pressBackAgain);
} else if (!isCanceled) {
await stopPatcher();
} else {
_toast.showBottom(t.installerView.noExit);
}
return false;
Future<void> onPopAttempt(BuildContext context) async {
if (!cancel) {
cancel = true;
_toast.showBottom(t.installerView.pressBackAgain);
} else if (!isCanceled) {
await stopPatcher();
} else {
_toast.showBottom(t.installerView.noExit);
}
}
void onPop() {
if (!cancel) {
cleanPatcher();
} else {
_patcherAPI.cleanPatcher();
}
screenshotCallback.dispose();
Navigator.of(context).pop();
return true;
ScreenshotCallback().dispose();
}
}