ZoomRotatePageTransition<T> constructor

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

Implementation

ZoomRotatePageTransition({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);

          final rotationAnimation = Tween<double>(
            begin: -30.0, // Adjust the rotation angle as desired
            end: 0.0,
          ).animate(animation);

          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);

          return Transform.scale(
            scale: scaleAnimation.value,
            child: Transform.rotate(
              angle: rotationAnimation.value * (math.pi / 180),
              alignment: Alignment.center,
              child: SlideTransition(
                position: offsetAnimation,
                child: child,
              ),
            ),
          );
        },
      );