RotateAnimation<T> constructor

RotateAnimation<T>({
  1. required Widget page,
  2. required bool isClockwise,
})

Determines the direction of rotation. Constructor for the RotateAnimation class.

Implementation

/// Constructor for the RotateAnimation class.
RotateAnimation({required this.page, required this.isClockwise})
    : super(
        pageBuilder: (context, animation, secondaryAnimation) => page,
        transitionsBuilder: (context, animation, secondaryAnimation, child) {
          final rotationValue = Tween<double>(
            begin: 0.0,
            end: isClockwise ? 2 * pi : -2 * pi,
          ).animate(animation);

          return AnimatedBuilder(
            animation: animation,
            builder: (context, child) {
              return Transform.rotate(
                angle: rotationValue.value,
                child: child,
              );
            },
            child: child,
          );
        },
      );