pushRotate static method

void pushRotate({
  1. required BuildContext context,
  2. required Widget nextPage,
  3. Duration duration = const Duration(milliseconds: 500),
  4. int numberOfTurns = 1,
  5. bool clockwise = true,
})

Pushes a new page onto the navigation stack with a rotate transition animation. The context parameter is the context of the current page. The nextPage parameter is the widget that will be displayed on the new page. The duration parameter specifies the duration of the animation, with a default of 500 milliseconds. The numberOfTurns parameter specifies the number of half rotations the animation will make, with a default of 1. The clockwise parameter specifies the direction of rotation, with true meaning clockwise and false meaning counterclockwise.

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

Implementation

static void pushRotate({
  required BuildContext context,
  required Widget nextPage,
  Duration duration = const Duration(milliseconds: 500),
  int numberOfTurns = 1,
  bool clockwise = true,
}) {
  Navigator.push(
    context,
    RotatePageRoute(
      nextPage: nextPage,
      currentPage: context.widget,
      animationDuration: duration,
      numberOfRotations: numberOfTurns,
      clockwise: clockwise,
    ),
  );
}