fixed timer stop state

This commit is contained in:
Vadim 2024-04-30 22:01:19 +02:00
parent faeca1adbd
commit b008ef7c83

View file

@ -38,9 +38,10 @@ class TimerBloc extends Bloc<TimerEvent, TimerState> {
); );
_timer = Timer.periodic(const Duration(seconds: 1), (_) { _timer = Timer.periodic(const Duration(seconds: 1), (_) {
add(SetTimeLeftEvent(state.timeLeft - const Duration(seconds: 1)));
if (state.timeLeft.inMilliseconds == 0) { if (state.timeLeft.inMilliseconds == 0) {
add(const StopTimerEvent()); add(const StopTimerEvent());
} else {
add(SetTimeLeftEvent(state.timeLeft - const Duration(seconds: 1)));
} }
}); });
} }