You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
805 B

2 years ago
2 years ago
2 years ago
2 years ago
  1. import 'package:flutter_bloc/flutter_bloc.dart';
  2. import 'package:my_flutter_puzzle/cubits/base_cubit_type.dart';
  3. class CountDownTimerCubit extends Cubit<BaseCubitType<CountDownTimerState>> {
  4. Duration? _duration;
  5. CountDownTimerCubit() : super(BaseCubitType(eventName: CountDownTimerState.empty));
  6. void empty() => emit(BaseCubitType(eventName: CountDownTimerState.empty));
  7. void start() => emit(BaseCubitType(eventName: CountDownTimerState.start));
  8. void stop() => emit(BaseCubitType(eventName: CountDownTimerState.stop));
  9. void reset() => emit(BaseCubitType(eventName: CountDownTimerState.reset));
  10. void setDuration(Duration duration) {
  11. _duration = duration;
  12. }
  13. Duration? getDuration() {
  14. return _duration;
  15. }
  16. }
  17. enum CountDownTimerState {
  18. empty,
  19. start,
  20. stop,
  21. reset,
  22. }