transitionsBuilder property
(Widget Function(BuildContext context, Animation<double> animation, Animation<double> secondaryAnimation, Widget child)?)
transitionsBuilder
final
Define a transition builder to be used for the sub route.
In the follwing example Page1 will be animated using the custom definition, whereas all other pages will use the default animation.
final myNavigator = NavigationBuilder.create(
// Default transition
transitionDuration: RM.transitions.leftToRight(),
routes: {
'/': (_) => HomePage(),
'/Page1': (_) => RouteWidget(
builder: (_) => Page1(),
// You can use one of the predefined transitions
transitionsBuilder: (context, animation, secondAnimation, child) {
// Custom transition implementation
return ...;
},
),
'/page2': (_) => Page2(),
},
);
Implementation
final Widget Function(
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child,
)? transitionsBuilder;