Skip to content

Commit

Permalink
fix: Migrate to onPopInvokedWithResult
Browse files Browse the repository at this point in the history
Reference: https://docs.flutter.dev/release/breaking-changes/popscope-with-result
Signed-off-by: validcube <pun.butrach@gmail.com>
  • Loading branch information
validcube committed Sep 6, 2024
1 parent 646feae commit 43d5888
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/ui/views/installer/installer_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/views/navigation/navigation_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 43d5888

Please sign in to comment.