snapBack method
Implementation
Future<void> snapBack(double target) async {
final double start = pullOffset.value;
if ((start - target).abs() < 0.5) {
pullOffset.value = target;
hasThresholdBeenReached.value = false;
return;
}
final motion = Get.isRegistered<MotionController>()
? Get.find<MotionController>()
: null;
final speed = motion?.speedMultiplier ?? 1.0;
isCollapsing.value = true;
activeTween = Tween<double>(
begin: start,
end: target,
).chain(CurveTween(curve: collapseCurve));
resetController.duration = Duration(
milliseconds: (collapseDuration.inMilliseconds / speed).round(),
);
resetController.reset();
await resetController.forward();
isCollapsing.value = false;
hasThresholdBeenReached.value = false;
}