FadeThroughPageTransitionsBuilder class

Used by PageTransitionsTheme to define a page route transition animation in which the outgoing page fades out, then the incoming page fades in and scale up.

This pattern is recommended for a transition between UI elements that do not have a strong relationship to one another.

Scale is only applied to incoming elements to emphasize new content over old.

The following example shows how the FadeThroughPageTransitionsBuilder can be used in a PageTransitionsTheme to change the default transitions of MaterialPageRoutes.

MaterialApp(
  theme: ThemeData(
    pageTransitionsTheme: PageTransitionsTheme(
      builders: {
        TargetPlatform.android: FadeThroughPageTransitionsBuilder(),
        TargetPlatform.iOS: FadeThroughPageTransitionsBuilder(),
      },
    ),
  ),
  routes: {
    '/': (BuildContext context) {
      return Container(
        color: Colors.red,
        child: Center(
          child: TextButton(
            child: Text('Push route'),
            onPressed: () {
              Navigator.of(context).pushNamed('/a');
            },
          ),
        ),
      );
    },
    '/a' : (BuildContext context) {
      return Container(
        color: Colors.blue,
        child: Center(
          child: TextButton(
            child: Text('Pop route'),
            onPressed: () {
              Navigator.of(context).pop();
            },
          ),
        ),
      );
    },
  },
);
Inheritance

Constructors

FadeThroughPageTransitionsBuilder({Color? fillColor})
Creates a FadeThroughPageTransitionsBuilder.
const

Properties

fillColor Color?
The color to use for the background color during the transition.
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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