mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-24 01:36:26 +01:00
528699d7c5
This is no longer supported in the revamped code
37 lines
1,004 B
Dart
37 lines
1,004 B
Dart
part of '../misc_settings.dart';
|
|
|
|
@npLog
|
|
class _Bloc extends Bloc<_Event, _State> with BlocLogger {
|
|
_Bloc({
|
|
required this.prefController,
|
|
}) : super(_State(
|
|
isDoubleTapExit: prefController.isDoubleTapExitValue,
|
|
)) {
|
|
on<_Init>(_onInit);
|
|
on<_SetDoubleTapExit>(_onSetDoubleTapExit);
|
|
}
|
|
|
|
@override
|
|
String get tag => _log.fullName;
|
|
|
|
Future<void> _onInit(_Init ev, Emitter<_State> emit) async {
|
|
_log.info(ev);
|
|
await Future.wait([
|
|
emit.forEach<bool>(
|
|
prefController.isDoubleTapExitChange,
|
|
onData: (data) => state.copyWith(isDoubleTapExit: data),
|
|
onError: (e, stackTrace) {
|
|
_log.severe("[_onInit] Uncaught exception", e, stackTrace);
|
|
return state.copyWith(error: ExceptionEvent(e, stackTrace));
|
|
},
|
|
),
|
|
]);
|
|
}
|
|
|
|
void _onSetDoubleTapExit(_SetDoubleTapExit ev, Emitter<_State> emit) {
|
|
_log.info(ev);
|
|
prefController.setDoubleTapExit(ev.value);
|
|
}
|
|
|
|
final PrefController prefController;
|
|
}
|