MessageAnimations constructor

MessageAnimations(
  1. TickerProvider vsync
)

Creates message animations with the provided vsync ticker provider.

The animation automatically starts when created.

Implementation

MessageAnimations(TickerProvider vsync) {
  controller = AnimationController(
    duration: const Duration(
      milliseconds: AppConstants.messageAnimationDuration,
    ),
    vsync: vsync,
  );

  scaleAnimation = Tween<double>(
    begin: 0.8,
    end: 1.0,
  ).animate(CurvedAnimation(parent: controller, curve: Curves.easeOutBack));

  fadeAnimation = Tween<double>(
    begin: 0.0,
    end: 1.0,
  ).animate(CurvedAnimation(parent: controller, curve: Curves.easeInOut));

  controller.forward();
}