createSpinController function
Creates the AnimationController responsible for the 5-second spin duration.
Triggers onSpinComplete when the animation finishes.
Implementation
AnimationController createSpinController(
TickerProvider vsync, VoidCallback onSpinComplete) {
AnimationController controller = AnimationController(
vsync: vsync,
duration: const Duration(seconds: 5),
);
controller.addStatusListener((status) {
if (status == AnimationStatus.completed) {
onSpinComplete(); // Callback when spin finishes
}
});
return controller;
}