useAnimationController function
AnimationController
useAnimationController({
- TickerProvider? vsync,
- Duration? duration,
- String? debugLabel,
- double? lowerBound,
- double? upperBound,
- double? value,
- AnimationBehavior animationBehavior = AnimationBehavior.normal,
Creates an AnimationController.
The controller is automatically disposed when the widget is unmounted.
Implementation
AnimationController useAnimationController({
/// An optional [vsync] parameter to synchronize the animation.
/// If not provided, a ticker will be created automatically.
TickerProvider? vsync,
Duration? duration,
String? debugLabel,
double? lowerBound,
double? upperBound,
double? value,
AnimationBehavior animationBehavior = AnimationBehavior.normal,
}) {
vsync ??= useSingleTickerState();
final c = AnimationController(
vsync: vsync,
duration: duration,
debugLabel: debugLabel,
lowerBound: lowerBound ?? 0.0,
upperBound: upperBound ?? 1.0,
value: value,
animationBehavior: animationBehavior,
);
onBeforeUnmount(c.dispose);
return c;
}