useAnimationController function
AnimationControlleruseAnimationController({
- Duration?duration,
- Duration?reverseDuration,
- String?debugLabel,
- doubleinitialValue =0,
- doublelowerBound =0,
- doubleupperBound =1,
- TickerProvider?vsync,
- AnimationBehavioranimationBehavior =AnimationBehavior.normal,
- List<
Object?> ?keys,
Creates anAnimationController and automatically disposes it when necessary.
If novsync
is provided, theTickerProvider is implicitly obtained usinguseSingleTickerProvider.If avsync
is specified, changing the instance ofvsync
will result in a call toAnimationController.resync.It is not possible to switch between implicit and explicitvsync
.
Changing theduration
parameter automatically updates theAnimationController.duration.
initialValue
,lowerBound
,upperBound
anddebugLabel
are ignored after the first call.
See also:
- AnimationController, the created object.
- useAnimation, to listen to the createdAnimationController.
Implementation
AnimationController useAnimationController({ Duration? duration, Duration? reverseDuration, String? debugLabel, double initialValue = 0, double lowerBound = 0, double upperBound = 1, TickerProvider? vsync, AnimationBehavior animationBehavior = AnimationBehavior.normal, List<Object?>? keys,}) { vsync ??= useSingleTickerProvider(keys: keys); return use( _AnimationControllerHook( duration: duration, reverseDuration: reverseDuration, debugLabel: debugLabel, initialValue: initialValue, lowerBound: lowerBound, upperBound: upperBound, vsync: vsync, animationBehavior: animationBehavior, keys: keys, ), );}