animateAfter method

Widget animateAfter({
  1. Duration duration = const Duration(milliseconds: 350),
  2. Curve curve = appleEaseInOut,
  3. int repeat = 0,
  4. bool reverse = false,
  5. Duration delay = Duration.zero,
  6. VoidCallback? onEnd,
  7. BooleanCallback? playIf,
})

Animate the effects applied to this widget after the last animation in the chain ends.

Unlike animate, this method does not trigger the animation immediately and instead waits for the last animation in the chain to end. This does not give this effect autonomy over its animations, rather it stays idle. The last animation that plays will look up the ancestor tree for the next AnimatedEffect and trigger it manually if shouldTriggerAfterLast is true.

The duration parameter is used to set the duration of the animation.

The curve parameter is used to set the curve of the animation.

The onEnd parameter is used to set a callback that is called when the animation ends.

The repeat parameter is used to determine how the animation should be repeated.

The reverse parameter is used to determine whether the animation should play backwards after each repetition.

The delay parameter is used to set a delay before the animation starts.

The playIf parameter is used to determine whether the animation should be played or skipped. If the callback returns false, the animation will be skipped, even when it is explicitly triggered.

Implementation

Widget animateAfter({
  Duration duration = const Duration(milliseconds: 350),
  Curve curve = appleEaseInOut,
  int repeat = 0,
  bool reverse = false,
  Duration delay = Duration.zero,
  VoidCallback? onEnd,
  BooleanCallback? playIf,
}) {
  return AnimatedEffect(
    triggerType: AnimationTriggerType.afterLast,
    trigger: false,
    duration: duration,
    curve: curve,
    repeat: repeat,
    reverse: reverse,
    delay: delay,
    onEnd: onEnd,
    playIf: playIf,
    child: this,
  );
}