CustomNavigator class
A utility class that provides static methods for navigating between pages with custom transitions. This class is used to encapsulate the logic for pushing pages with various transition animations, making it easier to apply consistent transitions throughout the application.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
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
Static Methods
-
push(
ParentAnimation animation) → void -
Constructs a Navigator object that pushes a new page onto the navigation stack with a custom transition animation.
The
animationparameter is an instance of a ParentAnimation class that defines the animation to be used. Theanimationparameter can be any of the following types: -
pushAndRemoveUntil(
ParentAnimation animation, bool predicate(Route)) → void -
Constructs a Navigator object that pushes a new page onto the navigation stack with a custom transition animation and removes all pages from the navigation stack until the predicate returns true.
The
animationparameter is an instance of a ParentAnimation class that defines the animation to be used. Theanimationparameter can be any of the following types: -
pushCorner(
{required BuildContext context, Corner corner = Corner.bottomLeft, required Widget nextPage, Duration duration = const Duration(milliseconds: 500)}) → void -
Pushes a new page onto the navigation stack with a corner transition animation.
The
contextparameter is the context of the current page. ThenextPageparameter is the widget that will be displayed on the new page. Thecornerparameter specifies the corner of the screen where the new page will appear, with a default ofCorner.bottomLeft. Thedurationparameter specifies the duration of the animation, with a default of 500 milliseconds. -
pushFadeScale(
{required BuildContext context, required Widget nextPage, Duration duration = const Duration(milliseconds: 500), double initialScale = 0.0}) → void -
Pushes a new page onto the navigation stack with a fade and scale transition animation.
The
contextparameter is the context of the current page. ThenextPageparameter is the widget that will be displayed on the new page. Thedurationparameter specifies the duration of the animation, with a default of 500 milliseconds. TheinitialScaleparameter specifies the initial scale of the page being pushed, with a default of 0.0. -
pushFlip(
{required BuildContext context, required Widget nextPage, Duration duration = const Duration(milliseconds: 500), AxisDirection axis = AxisDirection.left, bool fadeIn = true, bool forward = false}) → void -
Pushes a new page onto the navigation stack with a flip transition animation.
The
contextparameter is the context of the current page. ThenextPageparameter is the widget that will be displayed on the new page. Thedurationparameter specifies the duration of the animation, with a default of 500 milliseconds. Theaxisparameter specifies the axis along which the flip animation should occur, with a default of AxisDirection.left. ThefadeInparameter determines whether the next page should fade in or not, with a default oftrue. Theforwardparameter determines whether the flip animation should go from left to right (true) or right to left (false), with a default offalse. -
pushFlyin(
{required BuildContext context, required Widget nextPage, Duration duration = const Duration(milliseconds: 500), AxisDirection axis = AxisDirection.left, AxisDirection inclination = AxisDirection.up, bool fadeIn = true, bool forward = false}) → void -
Pushes a new page onto the navigation stack with a fly-in transition animation.
The
contextparameter is the context of the current page. ThenextPageparameter is the widget that will be displayed on the new page. Thedurationparameter specifies the duration of the animation, with a default of 500 milliseconds. Theaxisparameter specifies the axis along which the fly-in animation should occur, with a default of AxisDirection.left. Theinclinationparameter specifies the axis along which the fly-in animation should be inclined, with a default of AxisDirection.up. ThefadeInparameter determines whether the next page should fade in or not, with a default oftrue. Theforwardparameter determines whether the fly-in animation should go from left to right (true) or right to left (false), with a default offalse. -
pushReplacement(
ParentAnimation animation) → void -
Constructs a Navigator object that pushes a new page onto the navigation stack with a custom transition animation and replaces the current page.
The
animationparameter is an instance of a ParentAnimation class that defines the animation to be used. Theanimationparameter can be any of the following types: -
pushRotate(
{required BuildContext context, required Widget nextPage, Duration duration = const Duration(milliseconds: 500), int numberOfTurns = 1, bool clockwise = true}) → void -
Pushes a new page onto the navigation stack with a rotate transition animation.
The
contextparameter is the context of the current page. ThenextPageparameter is the widget that will be displayed on the new page. Thedurationparameter specifies the duration of the animation, with a default of 500 milliseconds. ThenumberOfTurnsparameter specifies the number of half rotations the animation will make, with a default of 1. Theclockwiseparameter specifies the direction of rotation, withtruemeaning clockwise andfalsemeaning counterclockwise. -
pushSlide(
{required BuildContext context, required Widget nextPage, AxisDirection direction = AxisDirection.left, Duration duration = const Duration(milliseconds: 500)}) → void -
Pushes a new page onto the navigation stack with a slide transition animation.
The
contextparameter is the context of the current page. ThenextPageparameter is the widget that will be displayed on the new page. Thedirectionparameter specifies the direction of the slide animation, with a default ofAxisDirection.left. Thedurationparameter specifies the duration of the animation, with a default of 500 milliseconds. -
pushSwirl(
{required BuildContext context, required Widget nextPage, Duration duration = const Duration(milliseconds: 500), int numHalfRotations = 1, bool forward = true, Axis axis = Axis.vertical}) → void -
Pushes a new page onto the navigation stack with a swirl transition animation.
The
contextparameter is the context of the current page. ThenextPageparameter is the widget that will be displayed on the new page. Thedurationparameter specifies the duration of the animation, with a default of 500 milliseconds. ThenumHalfRotationsparameter specifies the number of half rotations the swirl animation should make, with a default of 1. Theforwardparameter determines the direction of the swirl animation, withtruemeaning the swirl goes outward andfalsemeaning it goes inward. Theaxisparameter specifies the axis along which the swirl animation should occur, with a default ofAxis.vertical.