AnimationController constructor
- double? value,
- Duration? duration,
- Duration? reverseDuration,
- String? debugLabel,
- double lowerBound = 0.0,
- double upperBound = 1.0,
- AnimationBehavior animationBehavior = AnimationBehavior.normal,
- required TickerProvider vsync,
Creates an animation controller.
-
value
is the initial value of the animation. If defaults to the lower bound. -
duration
is the length of time this animation should last. -
debugLabel
is a string to help identify this animation during debugging (used by toString). -
lowerBound
is the smallest value this animation can obtain and the value at which this animation is deemed to be dismissed. -
upperBound
is the largest value this animation can obtain and the value at which this animation is deemed to be completed. -
vsync
is the required TickerProvider for the current context. It can be changed by calling resync. See TickerProvider for advice on obtaining a ticker provider.
Implementation
AnimationController({
double? value,
this.duration,
this.reverseDuration,
this.debugLabel,
this.lowerBound = 0.0,
this.upperBound = 1.0,
this.animationBehavior = AnimationBehavior.normal,
required TickerProvider vsync,
}) : assert(upperBound >= lowerBound),
_direction = _AnimationDirection.forward {
if (kFlutterMemoryAllocationsEnabled) {
_maybeDispatchObjectCreation();
}
_ticker = vsync.createTicker(_tick);
_internalSetValue(value ?? lowerBound);
}