animate method

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

Animate the effects applied to this widget.

The trigger parameter is used to trigger the animation. As long as the value of trigger is the same, the animation will not be triggered again.

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.

The startImmediately parameter is used to determine whether the animation should be triggered immediately when the widget is built, ignoring the value of trigger initially.

Implementation

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