resetAnimation method
void
resetAnimation({
- Duration? duration,
- Duration? reverseDuration,
- Curve? curve,
- Curve? reverseCurve,
- int? repeats,
- bool? shouldReverseRepeats,
override
Used to change any of the global parameters fo the animation such as duration, reverseDuration, curve, reverseCurve, repeats and shouldReverseRepeats.
Change is taken instantaneously while the animation is playing
Implementation
@override
void resetAnimation({
Duration? duration,
Duration? reverseDuration,
Curve? curve,
Curve? reverseCurve,
int? repeats,
bool? shouldReverseRepeats,
}) {
if (duration != null) {
_controller?.duration = duration;
}
if (reverseDuration != null) {
_controller?.reverseDuration = reverseDuration;
}
if (repeats != null) {
this.repeats = repeats;
repeatCount = null;
}
if (shouldReverseRepeats != null) {
this.shouldReverseRepeats = shouldReverseRepeats;
repeatCount = null;
}
bool isCurveChanged = false;
if (curve != null) {
this.curve = curve;
isCurveChanged = true;
}
if (reverseCurve != null) {
this.reverseCurve = reverseCurve;
isCurveChanged = true;
}
if (isCurveChanged) {
for (var fn in _resetAnimationListeners) {
fn();
}
_curvedAnimation = null;
_reverseCurvedAnimation = null;
}
}