createController method
AnimationController
createController({
- required TickerProvider vsync,
- required Duration duration,
- bool repeat = true,
- bool reverse = false,
- VoidCallback? listener,
Creates and manages an AnimationController.
vsync: Ticker providerduration: Duration of the animationrepeat: Whether the animation should repeatreverse: Whether the animation should reverselistener: Optional listener to be called on animation update
Implementation
AnimationController createController({
required TickerProvider vsync,
required Duration duration,
bool repeat = true,
bool reverse = false,
VoidCallback? listener,
}) {
final controller = AnimationController(vsync: vsync, duration: duration);
if (repeat) {
controller.repeat(reverse: reverse);
} else {
controller.forward();
}
if (listener != null) {
controller.addListener(listener);
}
controllers.add(controller);
return controller;
}