ZoomOutPageTransition<T> constructor

ZoomOutPageTransition<T>({
  1. required Widget page,
})

Implementation

ZoomOutPageTransition({required this.page})
    : super(
        pageBuilder: (context, animation, secondaryAnimation) => page,
        transitionsBuilder: (context, animation, secondaryAnimation, child) {
          const begin = Offset(1.0, 0.0);
          const end = Offset.zero;
          const curve = Curves.easeInOut;
          var tween =
              Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
          var offsetAnimation = animation.drive(tween);

          const initialScale =
              1.5; // Adjust the initial scale factor as desired
          const endScale = 1.0;
          final scaleAnimation = Tween<double>(
            begin: initialScale,
            end: endScale,
          ).animate(animation);

          final blurAmount = Tween<double>(
            begin: 0.0,
            end: 10.0,
          ).animate(animation);

          return Stack(
            children: [
              BackdropFilter(
                filter: ImageFilter.blur(
                    sigmaX: blurAmount.value, sigmaY: blurAmount.value),
                child: Container(color: Colors.transparent),
              ),
              Transform.scale(
                scale: scaleAnimation.value,
                child: SlideTransition(
                  position: offsetAnimation,
                  child: child,
                ),
              ),
            ],
          );
        },
      );