initAnimation method

  1. @override
void initAnimation(
  1. AnimationController controller
)
override

Initialize the Animation.

Implementation

@override
void initAnimation(AnimationController controller) {
  final direction = textDirection;

  final inIntervalEnd = rotateOut ? 0.4 : 1.0;

  _slideIn = AlignmentTween(
    begin: Alignment.topCenter.add(alignment).resolve(direction),
    end: Alignment.center.add(alignment).resolve(direction),
  ).animate(
    CurvedAnimation(
      parent: controller,
      curve: Interval(0.0, inIntervalEnd, curve: Curves.linear),
    ),
  );

  _fadeIn = Tween<double>(begin: 0.0, end: 1.0).animate(
    CurvedAnimation(
      parent: controller,
      curve: Interval(0.0, inIntervalEnd, curve: Curves.easeOut),
    ),
  );

  if (rotateOut) {
    _slideOut = AlignmentTween(
      begin: Alignment.center.add(alignment).resolve(direction),
      end: Alignment.bottomCenter.add(alignment).resolve(direction),
    ).animate(
      CurvedAnimation(
        parent: controller,
        curve: const Interval(0.7, 1.0, curve: Curves.linear),
      ),
    );

    _fadeOut = Tween<double>(begin: 1.0, end: 0.0).animate(
      CurvedAnimation(
        parent: controller,
        curve: const Interval(0.7, 1.0, curve: Curves.easeIn),
      ),
    );
  }
}