mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 15:00:40 +00:00
haptics revision
This commit is contained in:
parent
eefcf58bb8
commit
4a9320f6c8
3 changed files with 4 additions and 7 deletions
|
@ -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;
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue