automatically close timer screen after timeout

This commit is contained in:
Vadim 2024-05-04 18:59:12 +02:00
parent 057c43cc62
commit fbd78986df

View file

@ -44,7 +44,9 @@ class TimerScreenState extends State<TimerScreen> with TickerProviderStateMixin
timelineController = AnimationController(vsync: this, duration: widget.duration); timelineController = AnimationController(vsync: this, duration: widget.duration);
timelineAnimation = Tween<double>(begin: 1, end: 0).animate(timelineController); timelineAnimation = Tween<double>(begin: 1, end: 0).animate(timelineController);
timelineController.addStatusListener((status) { timelineController.addStatusListener((status) {
if (status == AnimationStatus.completed) { if (timelineController.value == 1) {
Navigator.of(context).pop();
} else if (status == AnimationStatus.completed) {
context.read<TimerBloc>().add(const TimerEndedEvent()); context.read<TimerBloc>().add(const TimerEndedEvent());
} }
}); });