CupertinoPushPredictiveBackBuilder class

Slides pages in and out like iOS (CupertinoPageTransition) on push and pop, and plays Android's predictive back animation while the user swipes back.

PredictiveBackPageTransitionsBuilder only animates the swipe itself. Every other push or pop gets a fixed fade-forwards transition that can't be changed. This builder keeps the predictive swipe and uses the Cupertino slide for everything else:

  • Push, back button, Navigator.pop: Cupertino slide from the right, with the previous page moving left underneath. No fade.
  • Back swipe (Android 14+): the predictive back animation, driven by the gesture.
MaterialApp(
  theme: ThemeData(
    pageTransitionsTheme: const PageTransitionsTheme(
      builders: <TargetPlatform, PageTransitionsBuilder>{
        TargetPlatform.android: CupertinoPushPredictiveBackBuilder(),
        TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
      },
    ),
  ),
)

Use it for Android. On iOS keep CupertinoPageTransitionsBuilder, which adds the iOS edge swipe to go back. This builder leaves that swipe out because it competes with Android's back gesture.

Inheritance

Properties

delegatedTransition → DelegatedTransitionBuilder?
Provides a secondary transition to the previous route.
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
reverseTransitionDuration → Duration
The duration the transition going in reverse.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transitionDuration → Duration
The duration the transition going forwards.
no setteroverride

Methods

buildTransitions<T>(PageRoute<T> route, BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child) → Widget
Wraps the child with one or more transition widgets which define how route arrives on and leaves the screen.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited