oneShot method
- Key? key,
- Duration duration = const Duration(milliseconds: 350),
- Curve curve = appleEaseInOut,
- int repeat = 0,
- bool reverse = false,
- bool resetValues = false,
- bool interruptable = true,
- Duration delay = Duration.zero,
- VoidCallback? onEnd,
- BooleanCallback? playIf,
- BooleanCallback? skipIf,
- AnimationBehavior? animationBehavior,
Animate the effects applied to this widget.
Unlike animate, this method triggers the animation immediately without
a trigger parameter.
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 resetValues parameter is used to determine whether the animation
should start from idle values or from the current state of the widget.
If set to true, the animation will always animate from the initial
default state of an effect towards the current state.
When false, the animation will animate from the previous effect state
towards the current state.
The interruptable parameter is used to determine whether the animation
should be reset on subsequent triggers. If this animation is re-triggered,
it will reset the current active animation and re-drive from the
beginning.
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 skipIf parameter is used to determine whether the animation should
be skipped by setting the animation value to 1, effectively skipping the
animation to the ending values.
Implementation
AnimatedEffect oneShot({
Key? key,
Duration duration = const Duration(milliseconds: 350),
Curve curve = appleEaseInOut,
int repeat = 0,
bool reverse = false,
bool resetValues = false,
bool interruptable = true,
Duration delay = Duration.zero,
VoidCallback? onEnd,
BooleanCallback? playIf,
BooleanCallback? skipIf,
AnimationBehavior? animationBehavior,
}) {
return AnimatedEffect(
key: key,
triggerType: AnimationTriggerType.oneShot,
duration: duration,
curve: curve,
onEnd: onEnd,
repeat: repeat,
reverse: reverse,
resetValues: resetValues,
interruptable: interruptable,
delay: delay,
playIf: playIf,
skipIf: skipIf,
animationBehavior: animationBehavior,
child: this,
);
}