push static method
Constructs a Navigator object that pushes a new page onto the navigation stack with a custom transition animation.
The animation parameter is an instance of a ParentAnimation class that defines the animation to be used.
The animation parameter can be any of the following types:
Implementation
static void push(ParentAnimation animation) {
switch (animation) {
// - [FadeScaleAnimation]
case FadeScaleAnimation anim:
Navigator.push(
anim.context,
FadeScalePageRoute(
nextPage: anim.nextPage,
currentPage: anim.context.widget,
initialScale: anim.initialScale,
animationDuration: anim.duration,
),
);
break;
// - [FlipAnimation]
case FlipAnimation anim:
Navigator.push(
anim.context,
FlipPageRoute(
nextPage: anim.nextPage,
currentPage: anim.context.widget,
animationDuration: anim.duration,
axis: anim.axis,
fadeIn: anim.fadeIn,
forward: anim.forward,
),
);
break;
// - [FlyInAnimation]
case FlyInAnimation anim:
Navigator.push(
anim.context,
FlyInPageRoute(
nextPage: animation.nextPage,
currentPage: animation.context.widget,
animationDuration: animation.duration,
axis: anim.axis,
inclination: anim.inclination,
fadeIn: anim.fadeIn,
forward: anim.forward,
),
);
break;
// - [SlideAnimation]
case SlideAnimation anim:
Navigator.push(
anim.context,
SlidePageRoute(
nextPage: anim.nextPage,
currentPage: anim.context.widget,
animationDuration: anim.duration,
direction: anim.direction,
),
);
break;
// - [RotateAnimation]
case RotateAnimation anim:
Navigator.push(
anim.context,
RotatePageRoute(
nextPage: anim.nextPage,
currentPage: anim.context.widget,
animationDuration: anim.duration,
numberOfRotations: anim.numberOfRotations,
clockwise: anim.clockwise,
),
);
break;
// - [SwirlAnimation]
case SwirlAnimation anim:
Navigator.push(
anim.context,
SwirlPageRoute(
nextPage: anim.nextPage,
currentPage: anim.context.widget,
animationDuration: anim.duration,
numberOfHalfRotations: anim.numberOfHalfRotations,
forward: anim.forward,
axis: anim.axis,
),
);
break;
// - [CornerAnimation]
case CornerAnimation anim:
Navigator.push(
anim.context,
CornerPageRoute(
nextPage: anim.nextPage,
currentPage: anim.context.widget,
animationDuration: anim.duration,
corner: anim.corner,
),
);
break;
}
}