RubberAnimationController constructor
- AnimationControllerValue? lowerBoundValue,
- AnimationControllerValue? halfBoundValue,
- AnimationControllerValue? upperBoundValue,
- bool dismissable = false,
- double? initialValue,
- Duration? duration,
- String? debugLabel,
- AnimationBehavior animationBehavior = AnimationBehavior.normal,
- AnimationPadding? padding,
- SpringDescription? springDescription,
- 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).
-
lowerBoundValue
is the smallest value this animation can obtain and the value at which this animation is deemed to be dismissed. Defaults to 0% if dismissable and 10% if not. -
halfBoundValue is the half value this animation can obtain and the value at which this animation is deemed to be half expanded. It can be null.
-
dismissable if set true when the bottomsheet goes at 0 is dismissed
-
upperBoundValue
is the largest value this animation can obtain and the value at which this animation is deemed to be completed. It cannot be null. -
vsync
is the TickerProvider for the current context. It can be changed by calling resync. It is required and must not be null. See TickerProvider for advice on obtaining a ticker provider.
Implementation
RubberAnimationController({
AnimationControllerValue? lowerBoundValue,
this.halfBoundValue,
AnimationControllerValue? upperBoundValue,
this.dismissable = false,
this.initialValue,
this.duration,
this.debugLabel,
this.animationBehavior = AnimationBehavior.normal,
AnimationPadding? padding,
SpringDescription? springDescription,
required TickerProvider vsync,
}) : assert(!dismissable || (dismissable && halfBoundValue == null),
"dismissable sheets are imcompatible with halfBoundValue"),
lowerBoundValue = lowerBoundValue ??
AnimationControllerValue(percentage: dismissable ? 0.0 : 0.1),
upperBoundValue =
upperBoundValue ?? AnimationControllerValue(percentage: 0.9),
_padding = padding ?? AnimationPadding.contain() {
if (springDescription != null) _springDescription = springDescription;
_ticker = vsync.createTicker(_tick);
if (lowerBound != null) _internalSetValue(initialValue ?? lowerBound!);
}