Skip to content
pubscout

custom_will_pop_scope

2.1.1, released 3 years ago by helmybouchiha.me

Enables onWillPop callbacks on Cupertino page transitions and improves gesture feedback.

$ flutter pub add custom_will_pop_scope
Source repository

What it does

Provides a CustomWillPopScope widget that allows developers to handle back navigation and 'onWillPop' callbacks during Cupertino page transitions. It also improves visual feedback for rejected swipe-to-go-back gestures across platforms.

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

Use it when

  • You need 'onWillPop' functionality on Cupertino page transitions.
  • You want to intercept back gestures or hardware back button presses to prevent accidental data loss.
  • You need to restrict swipe-to-return behavior on specific screens.

Skip it when

  • You are using the standard WillPopScope or PopScope without needing Cupertino-specific page transition adjustments.

Strengths

  • Enables back interception on Cupertino transitions.
  • Improves visual feedback for rejected swipe-to-go-back gestures.
  • Supports customizable onWillPop and onPopAction callbacks.

Weaknesses

  • Requires careful state management for the 'canReturn' flag.
  • The 'onWillPop' property should not be changed once set.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
CustomWillPopScope(
  canReturn: _canReturn,
  onWillPop: _onWillPop,
  onPopAction: _onPopAction,
  child: Scaffold(
    appBar: AppBar(title: Text('Second Screen')),
    body: Center(child: Text('Content')),),
)

Alternatives

Packages that do the same job and could replace custom_will_pop_scope.