ShrinkAndFadeTransition<T> constructor

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

Implementation

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

          final scaleValue = Tween<double>(
            begin: 1.2,
            end: 1.0,
          ).animate(animation);

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

          return FadeTransition(
            opacity: fadeValue,
            child: ScaleTransition(
              scale: scaleValue,
              child: SlideTransition(
                position: offsetAnimation,
                child: child,
              ),
            ),
          );
        },
      );