Skip to content
pubscout

cupertino_will_pop_scope

1.2.1, released 4 years ago by benpesso.com

Enables onWillPop callbacks on Cupertino page transitions and improves swipe-to-go-back feedback.

WASM-ready
$ flutter pub add cupertino_will_pop_scope
Source repository

What it does

Provides a modified Cupertino page route and a ConditionalWillPopScope widget that allow onWillPop callbacks to work during iOS-style page transitions. It adds visual feedback when a swipe-to-go-back gesture is rejected and snapped back into place.

AI-written summary of version 1.2.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need onWillPop callbacks to work properly with Cupertino page transitions and iOS swipe-to-go-back gestures.
  • You want to provide visual feedback when a user attempts to swipe back on a screen with unsaved changes.

Skip it when

  • You are using the newer PopScope widget and Flutter's navigation system where custom route transitions aren't needed.
  • Your app does not use custom page transitions or iOS-style swipe gestures.

Strengths

  • Fixes limitations with onWillPop and swipe-to-go-back gestures on Cupertino transitions.
  • Includes a ConditionalWillPopScope widget to handle conditional route popping easily.
  • Works across multiple platforms.

Weaknesses

  • Relies on older WillPopScope/onWillPop patterns which may be deprecated or superseded in newer Flutter versions.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0

Configure CupertinoWillPopScopePageTransionsBuilder in your theme's pageTransitionsTheme.

return ConditionalWillPopScope(
  child: _MyScreenContent(),
  onWillPop: _onWillPop,
  shouldAddCallback: _hasChanges,
);

Alternatives

Packages that do the same job and could replace cupertino_will_pop_scope.