haptics revision

This commit is contained in:
Vadim 2023-02-11 15:57:51 +03:00
parent eefcf58bb8
commit 4a9320f6c8
3 changed files with 4 additions and 7 deletions

View file

@ -16,7 +16,7 @@ class UserPreferencesService {
static const _caffeineKey = "caffeine"; static const _caffeineKey = "caffeine";
static const _hapticsKey = "haptics"; static const _hapticsKey = "haptics";
static const _themeTypeKey = "themeType"; static const _themeTypeKey = "themeType";
static const _primaryColorKey = "primaryColor"; static const _primaryColorKey = "primaryColor";
static const _dynamicColorKey = "dynamicColor"; static const _dynamicColorKey = "dynamicColor";
@ -37,7 +37,7 @@ class UserPreferencesService {
bool get caffeine => _sharedPreferences.getBool(_caffeineKey) ?? false; bool get caffeine => _sharedPreferences.getBool(_caffeineKey) ?? false;
set caffeine(bool value) => _sharedPreferences.setBool(_caffeineKey, value); set caffeine(bool value) => _sharedPreferences.setBool(_caffeineKey, value);
bool get haptics => _sharedPreferences.getBool(_hapticsKey) ?? false; bool get haptics => _sharedPreferences.getBool(_hapticsKey) ?? true;
set haptics(bool value) => _sharedPreferences.setBool(_hapticsKey, value); set haptics(bool value) => _sharedPreferences.setBool(_hapticsKey, value);
double get cameraEvCalibration => _sharedPreferences.getDouble(_cameraEvCalibrationKey) ?? 0.0; double get cameraEvCalibration => _sharedPreferences.getDouble(_cameraEvCalibrationKey) ?? 0.0;

View file

@ -8,11 +8,8 @@ class HapticsListTileBloc extends Cubit<bool> {
this._settingsInteractor, this._settingsInteractor,
) : super(_settingsInteractor.isHapticsEnabled); ) : super(_settingsInteractor.isHapticsEnabled);
void onHapticsChange(bool value) { void onHapticsChanged(bool value) {
_settingsInteractor.enableHaptics(value); _settingsInteractor.enableHaptics(value);
if (value) {
_settingsInteractor.quickVibration();
}
emit(value); emit(value);
} }
} }

View file

@ -14,7 +14,7 @@ class HapticsListTile extends StatelessWidget {
secondary: const Icon(Icons.vibration), secondary: const Icon(Icons.vibration),
title: Text(S.of(context).haptics), title: Text(S.of(context).haptics),
value: state, value: state,
onChanged: context.read<HapticsListTileBloc>().onHapticsChange, onChanged: context.read<HapticsListTileBloc>().onHapticsChanged,
), ),
); );
} }