pub struct PredictiveBackPageTransitionsBuilder {
pub allow_snapshotting: bool,
pub fallback_color: Option<Color>,
}Expand description
Used by PageTransitionsTheme to define a MaterialPageRoute page transition animation
that looks like the default page transition used on Android U and above when using
predictive back.
Predictive back is only supported on Android U and above, and if this
PageTransitionsBuilder is used by any other platform, it will fall back to
FadeForwardsPageTransitionsBuilder.
When used on Android U and above, animates along with the back gesture to reveal the destination route. Can be canceled by dragging back towards the edge of the screen.
See also:
PredictiveBackFullscreenPageTransitionsBuilder, which is another variant of Android’s predictive back page transition.FadeForwardsPageTransitionsBuilder, which defines the default page transition that’s similar to the one provided in Android 16.ZoomPageTransitionsBuilder, which defines the default page transition that’s similar to the one provided in Android 10.OpenUpwardsPageTransitionsBuilder, which defines a page transition that’s similar to the one provided by Android 9.FadeUpwardsPageTransitionsBuilder, which defines a page transition that’s similar to the one provided by Android 8.CupertinoPageTransitionsBuilder, which defines a horizontal page transition that matches native iOS page transitions.PageRoute::allow_snapshotting, which enables or disables snapshotting on a per route basis similar to theallow_snapshottingparameter.- https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back#shared-element-transition, which is the Android spec for this page transition, called the Shared Element page transition.
Fields§
§allow_snapshotting: boolWhether page transitions will prefer to animate a snapshot of the entering and exiting routes.
If not specified, defaults to true.
When this value is true, page transitions will snapshot the entering and exiting routes. These snapshots are then animated in place of the underlying widgets to improve performance of the transition.
Generally this means that animations that occur on the entering/exiting route while the route animation plays may appear frozen - unless they are a hero animation or something that is drawn in a separate overlay.
fallback_color: Option<Color>The color of the scrim (background) when the predictive back transition is not supported.
If not provided, the background color of a default
FadeForwardsPageTransitionsBuilder will be used.
Implementations§
Source§impl PredictiveBackPageTransitionsBuilder
impl PredictiveBackPageTransitionsBuilder
Sourcepub const fn new() -> PredictiveBackPageTransitionsBuilder
pub const fn new() -> PredictiveBackPageTransitionsBuilder
Creates an instance of a PageTransitionsBuilder that matches Android U’s predictive
back transition.
Sourcepub const fn fallback_color(
self,
fallback_color: Color,
) -> PredictiveBackPageTransitionsBuilder
pub const fn fallback_color( self, fallback_color: Color, ) -> PredictiveBackPageTransitionsBuilder
Dart PredictiveBackPageTransitionsBuilder(fallbackColor:).
Sourcepub const fn allow_snapshotting(
self,
allow_snapshotting: bool,
) -> PredictiveBackPageTransitionsBuilder
pub const fn allow_snapshotting( self, allow_snapshotting: bool, ) -> PredictiveBackPageTransitionsBuilder
Dart PredictiveBackPageTransitionsBuilder(allowSnapshotting:).
Trait Implementations§
impl Copy for PredictiveBackPageTransitionsBuilder
Source§impl Default for PredictiveBackPageTransitionsBuilder
impl Default for PredictiveBackPageTransitionsBuilder
Source§fn default() -> PredictiveBackPageTransitionsBuilder
fn default() -> PredictiveBackPageTransitionsBuilder
Source§impl PageTransitionsBuilder for PredictiveBackPageTransitionsBuilder
impl PageTransitionsBuilder for PredictiveBackPageTransitionsBuilder
Source§fn transition_duration(&self) -> Duration
fn transition_duration(&self) -> Duration
Source§fn build_transitions(
&self,
_app: &mut App,
route: AnyPageRoute,
_context: BuildContext,
animation: AnimationRef<f64>,
secondary_animation: AnimationRef<f64>,
child: WidgetRef,
) -> WidgetRef
fn build_transitions( &self, _app: &mut App, route: AnyPageRoute, _context: BuildContext, animation: AnimationRef<f64>, secondary_animation: AnimationRef<f64>, child: WidgetRef, ) -> WidgetRef
route arrives on
and leaves the screen. Read more