getSettings method

  1. @override
AnimationSettings getSettings(
  1. WidgetRestingEffects effects,
  2. AnimationController animationController
)
override

Implementation

@override
AnimationSettings getSettings(
    WidgetRestingEffects effects, AnimationController animationController) {
  AnimationSettings _animationSettings =
      AnimationSettings(animationController: animationController);

  double strength = -20.0;
  strength = (strength * effects.effectStrength!).clamp(-1000, 1000);

  _animationSettings.offsetYAnimation = TweenSequence<double>(
    <TweenSequenceItem<double>>[
      TweenSequenceItem<double>(
        tween: Tween<double>(begin: 0, end: strength)
            .chain(CurveTween(curve: Curves.easeInOut)),
        weight: 50.0,
      ),
      TweenSequenceItem<double>(
        tween: Tween<double>(begin: strength, end: 0)
            .chain(CurveTween(curve: Curves.bounceOut)),
        weight: 50.0,
      ),
    ],
  ).animate(
      CurvedAnimation(parent: animationController, curve: Curves.linear));

  return _animationSettings;
}