fix: Migrate to onPopInvokedWithResult

Reference: https://docs.flutter.dev/release/breaking-changes/popscope-with-result
Signed-off-by: validcube <pun.butrach@gmail.com>
This commit is contained in:
validcube 2024-09-06 21:38:44 +07:00
parent 646feae0ec
commit 43d5888182
No known key found for this signature in database
GPG key ID: DBA94253E1D3F267
2 changed files with 4 additions and 4 deletions

View file

@ -16,9 +16,9 @@ class InstallerView extends StatelessWidget {
return ViewModelBuilder<InstallerViewModel>.reactive(
onViewModelReady: (model) => model.initialize(context),
viewModelBuilder: () => InstallerViewModel(),
builder: (context, model, child) => PopScope(
builder: (context, model, child) => PopScope<Object?>(
canPop: !model.isPatching,
onPopInvoked: (bool didPop) {
onPopInvokedWithResult: (bool didPop, Object? result) {
if (didPop) {
model.onPop();
} else {

View file

@ -13,9 +13,9 @@ class NavigationView extends StatelessWidget {
return ViewModelBuilder<NavigationViewModel>.reactive(
onViewModelReady: (model) => model.initialize(context),
viewModelBuilder: () => locator<NavigationViewModel>(),
builder: (context, model, child) => PopScope(
builder: (context, model, child) => PopScope<Object?>(
canPop: model.currentIndex == 0,
onPopInvoked: (bool didPop) {
onPopInvokedWithResult: (bool didPop, Object? result) {
if (!didPop) {
model.setIndex(0);
}