m3_lightmeter/lib/screens/settings/components/haptics/bloc_list_tile_haptics.dart
Vadim c7ed4d332e Added haptics
added `HapticsService`

added haptics handling

added `HapticsInteractor`
2023-01-21 14:17:44 +03:00

18 lines
477 B
Dart

import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/interactors/haptics_interactor.dart';
class HapticsListTileBloc extends Cubit<bool> {
final HapticsInteractor _hapticsInteractor;
HapticsListTileBloc(
this._hapticsInteractor,
) : super(_hapticsInteractor.isEnabled);
void onHapticsChange(bool value) {
_hapticsInteractor.enableHaptics(value);
if (value) {
_hapticsInteractor.quickVibration();
}
emit(value);
}
}