onPlay property
Called when the animation begins playing (ie. after Animate.delay
,
immediately after AnimationController.forward is called).
Provides an opportunity to manipulate the AnimationController
(ex. to loop, reverse, stop, etc). This is never called if autoPlay
is false
. See also: onInit.
For example, this would pause the animation at its start:
foo.animate(
onPlay: (controller) => controller.stop()
).fadeIn()
This would loop the animation, reversing it on each loop:
foo.animate(
onPlay: (controller) => controller.repeat(reverse: true)
).fadeIn()
Implementation
final AnimateCallback? onPlay;