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 offset = 4;
  offset = (offset * effects.effectStrength!).clamp(-200, 200);

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

  return _animationSettings;
}