cancel method
Resets the speed of the fade-out animation to the speed corresponding to the defined action and forces the effect to fade out. In some cases, it cancels the effect altogether.
Implementation
void cancel({
required TouchRippleCancelledBehavior cancelledBehavior,
}) {
_fadeAnimation.duration = _behavior.canceledDuration ?? Duration.zero;
_fadeCurved.curve = _behavior.canceledCurve ?? _behavior.fadeOutCurve!;
fadeOut();
switch (cancelledBehavior) {
case TouchRippleCancelledBehavior.reverseSpread: _spreadAnimation.reverse(); break;
case TouchRippleCancelledBehavior.stopSpread: _spreadAnimation.stop(); break;
case TouchRippleCancelledBehavior.none: break;
default: throw Exception('An undeclared behavior instnace was defined.');
}
}