pushSwirl static method

void pushSwirl({
  1. required BuildContext context,
  2. required Widget nextPage,
  3. Duration duration = const Duration(milliseconds: 500),
  4. int numHalfRotations = 1,
  5. bool forward = true,
  6. Axis axis = Axis.vertical,
})

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

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 numHalfRotations parameter specifies the number of half rotations the swirl animation should make, with a default of 1. The forward parameter determines the direction of the swirl animation, with true meaning the swirl goes outward and false meaning it goes inward. The axis parameter specifies the axis along which the swirl animation should occur, with a default of Axis.vertical.

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

Implementation

static void pushSwirl({
  required BuildContext context,
  required Widget nextPage,
  Duration duration = const Duration(milliseconds: 500),
  int numHalfRotations = 1,
  bool forward = true,
  Axis axis = Axis.vertical,
}) {
  Navigator.push(
    context,
    SwirlPageRoute(
      nextPage: nextPage,
      currentPage: context.widget,
      animationDuration: duration,
      numberOfHalfRotations: numHalfRotations,
      forward: forward,
      axis: axis,
    ),
  );
}