SubAnimationController constructor
SubAnimationController({
- Duration? duration,
- Duration? reverseDuration,
- String? debugLabel,
- double initialValue = 0,
- double lowerBound = 0,
- double upperBound = 1,
- TickerProvider? vsync,
- AnimationBehavior animationBehavior = AnimationBehavior.normal,
- required SubValueBuild<
AnimationController> builder, - SubValueKeys? keys,
Creates an AnimationController and automatically disposes it when necessary.
If no vsync
is provided, the TickerProvider is implicitly obtained using a SubTickerProviderMixin.
Changing the duration
parameter automatically updates the AnimationController.duration.
initialValue
, lowerBound
, upperBound
and debugLabel
are ignored after the first call.
Implementation
SubAnimationController({
Duration? duration,
Duration? reverseDuration,
String? debugLabel,
double initialValue = 0,
double lowerBound = 0,
double upperBound = 1,
TickerProvider? vsync,
AnimationBehavior animationBehavior = AnimationBehavior.normal,
required super.builder,
SubValueKeys? keys,
}) : super.builder(
create: (context) => AnimationController(
value: initialValue,
vsync:
vsync ?? (context as StatefulElement).state as TickerProvider,
duration: duration,
reverseDuration: reverseDuration,
debugLabel: debugLabel,
lowerBound: lowerBound,
upperBound: upperBound,
animationBehavior: animationBehavior,
),
update: (context, previous) {
if (previous.duration != duration) {
previous.duration = duration;
}
if (previous.reverseDuration != reverseDuration) {
previous.reverseDuration = reverseDuration;
}
return previous;
},
keys: keys != null ? (context) => keys : null,
dispose: (context, value) => value.dispose(),
);