pushSlide static method

void pushSlide({
  1. required BuildContext context,
  2. required Widget nextPage,
  3. AxisDirection direction = AxisDirection.left,
  4. Duration duration = const Duration(milliseconds: 500),
})

Pushes a new page onto the navigation stack with a slide transition animation.

The nextPage parameter is the widget that will be displayed on the new page. The direction parameter specifies the direction of the slide animation, with a default of AxisDirection.left. The duration parameter specifies the duration of the animation, with a default of 500 milliseconds.

This method uses the SlidePageRoute class to create the custom transition animation.

Implementation

static void pushSlide({
  required BuildContext context,
  required Widget nextPage,
  AxisDirection direction = AxisDirection.left,
  Duration duration = const Duration(milliseconds: 500),
}) {
  Navigator.push(
    context,
    SlidePageRoute(
      nextPage: nextPage,
      currentPage: context.widget,
      animationDuration: duration,
      direction: direction,
    ),
  );
}