ResilientAnimationController constructor
ResilientAnimationController({
- bool broadcast = false,
- double? value,
- Duration? duration,
- Duration? reverseDuration,
- String? debugLabel,
- double lowerBound = 0.0,
- double upperBound = 1.0,
- AnimationBehavior animationBehavior = AnimationBehavior.normal,
- required TickerProvider vsync,
Creates a resilient animation controller with bounded limits.
broadcast: Whether to broadcast updates to multiple subscribers. Defaults tofalse.value: The initial value of the animation. Defaults tolowerBound.duration: The length of time this animation should last.reverseDuration: The length of time this animation should last when going in reverse.debugLabel: A label used to identify this animation in debug output.lowerBound: The minimum value for this animation. Defaults to0.0.upperBound: The maximum value for this animation. Defaults to1.0.animationBehavior: The behavior when animations are disabled by system settings. Defaults to AnimationBehavior.normal.vsync: The TickerProvider for driving the animation ticker.
Requires:
upperBoundmust be greater than or equal tolowerBound.
Ensures:
- Initializes in a dormant state (
_DormantAnimationControlDelegate) until the coral resource is activated.
Example:
final controller = ResilientAnimationController(
duration: const Duration(milliseconds: 300),
vsync: vsyncProvider,
);
Implementation
ResilientAnimationController({
this.broadcast = false,
double? value,
Duration? duration,
Duration? reverseDuration,
this.debugLabel,
this.lowerBound = 0.0,
this.upperBound = 1.0,
this.animationBehavior = AnimationBehavior.normal,
required this.vsync,
}) : assert(upperBound >= lowerBound) {
assert(debugMaybeDispatchCreated('animation', 'AnimationController', this));
_delegate = _DormantAnimationControlDelegate(
value: value ?? lowerBound,
duration: duration,
reverseDuration: reverseDuration,
lowerBound: lowerBound,
upperBound: upperBound,
onValueOrDurationChanged: notifyListeners,
);
}