createAnimation<T> method
Animation<T>
createAnimation<T>({
- required TickerProvider vsync,
- required AnimationController controller,
- required Tween<
T> tween, - VoidCallback? listener,
Creates and manages a tween-based Animation from a given controller.
If the tween is of type double, it will be stored in animations list
to allow custom control or synchronization.
vsync: Ticker provider (not used directly, but for consistency)controller: Animation controllertween: Tween definitionlistener: Optional listener on animation updates
Implementation
Animation<T> createAnimation<T>({
required TickerProvider vsync,
required AnimationController controller,
required Tween<T> tween,
VoidCallback? listener,
}) {
final animation = tween.animate(controller);
if (listener != null) {
animation.addListener(listener);
}
if (T == double) {
animations.add(animation as Animation<double>);
}
return animation;
}