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
31 lines
805 B
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:my_flutter_puzzle/cubits/base_cubit_type.dart';
|
|
|
|
class CountDownTimerCubit extends Cubit<BaseCubitType<CountDownTimerState>> {
|
|
Duration? _duration;
|
|
|
|
CountDownTimerCubit() : super(BaseCubitType(eventName: CountDownTimerState.empty));
|
|
|
|
void empty() => emit(BaseCubitType(eventName: CountDownTimerState.empty));
|
|
|
|
void start() => emit(BaseCubitType(eventName: CountDownTimerState.start));
|
|
|
|
void stop() => emit(BaseCubitType(eventName: CountDownTimerState.stop));
|
|
|
|
void reset() => emit(BaseCubitType(eventName: CountDownTimerState.reset));
|
|
|
|
void setDuration(Duration duration) {
|
|
_duration = duration;
|
|
}
|
|
|
|
Duration? getDuration() {
|
|
return _duration;
|
|
}
|
|
}
|
|
|
|
enum CountDownTimerState {
|
|
empty,
|
|
start,
|
|
stop,
|
|
reset,
|
|
}
|