pushFadeScale static method

void pushFadeScale({
  1. required BuildContext context,
  2. required Widget nextPage,
  3. Duration duration = const Duration(milliseconds: 500),
  4. double initialScale = 0.0,
})

Pushes a new page onto the navigation stack with a fade and scale 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 initialScale parameter specifies the initial scale of the page being pushed, with a default of 0.0.

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

Implementation

static void pushFadeScale({
  required BuildContext context,
  required Widget nextPage,
  Duration duration = const Duration(milliseconds: 500),
  double initialScale = 0.0,
}) {
  Navigator.push(
    context,
    FadeScalePageRoute(
      nextPage: nextPage,
      currentPage: context.widget,
      animationDuration: duration,
      initialScale: initialScale,
    ),
  );
}