fixed dependencies

This commit is contained in:
Vadim 2023-04-05 22:08:13 +03:00
parent 34aceb9411
commit eb57a08874
4 changed files with 24 additions and 23 deletions

View file

@ -37,15 +37,15 @@ class UserPreferencesService {
Future<void> _migrateOldKeys() async { Future<void> _migrateOldKeys() async {
final legacyIsoIndex = _sharedPreferences.getInt("curIsoIndex"); final legacyIsoIndex = _sharedPreferences.getInt("curIsoIndex");
if (legacyIsoIndex != null) { if (legacyIsoIndex != null) {
iso = isoValues[legacyIsoIndex]; iso = IsoValue.values[legacyIsoIndex];
await _sharedPreferences.remove("curIsoIndex"); await _sharedPreferences.remove("curIsoIndex");
} }
final legacyNdIndex = _sharedPreferences.getInt("curndIndex"); final legacyNdIndex = _sharedPreferences.getInt("curndIndex");
if (legacyNdIndex != null) { if (legacyNdIndex != null) {
/// Legacy ND list has 1 extra value at the end, so this check is needed /// Legacy ND list has 1 extra value at the end, so this check is needed
if (legacyNdIndex < ndValues.length) { if (legacyNdIndex < NdValue.values.length) {
ndFilter = ndValues[legacyNdIndex]; ndFilter = NdValue.values[legacyNdIndex];
} }
await _sharedPreferences.remove("curndIndex"); await _sharedPreferences.remove("curndIndex");
} }
@ -70,11 +70,11 @@ class UserPreferencesService {
} }
IsoValue get iso => IsoValue get iso =>
isoValues.firstWhere((v) => v.value == (_sharedPreferences.getInt(_isoKey) ?? 100)); IsoValue.values.firstWhere((v) => v.value == (_sharedPreferences.getInt(_isoKey) ?? 100));
set iso(IsoValue value) => _sharedPreferences.setInt(_isoKey, value.value); set iso(IsoValue value) => _sharedPreferences.setInt(_isoKey, value.value);
NdValue get ndFilter => NdValue get ndFilter =>
ndValues.firstWhere((v) => v.value == (_sharedPreferences.getInt(_ndFilterKey) ?? 0)); NdValue.values.firstWhere((v) => v.value == (_sharedPreferences.getInt(_ndFilterKey) ?? 0));
set ndFilter(NdValue value) => _sharedPreferences.setInt(_ndFilterKey, value.value); set ndFilter(NdValue value) => _sharedPreferences.setInt(_ndFilterKey, value.value);
EvSourceType get evSourceType => EvSourceType get evSourceType =>
@ -95,6 +95,7 @@ class UserPreferencesService {
}; };
} }
} }
set meteringScreenLayout(MeteringScreenLayoutConfig value) => set meteringScreenLayout(MeteringScreenLayoutConfig value) =>
_sharedPreferences.setString(_meteringScreenLayoutKey, json.encode(value.toJson())); _sharedPreferences.setString(_meteringScreenLayoutKey, json.encode(value.toJson()));

View file

@ -21,10 +21,10 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
static const EquipmentProfileData _defaultProfile = EquipmentProfileData( static const EquipmentProfileData _defaultProfile = EquipmentProfileData(
id: '', id: '',
name: '', name: '',
apertureValues: apertureValues, apertureValues: ApertureValue.values,
ndValues: ndValues, ndValues: NdValue.values,
shutterSpeedValues: shutterSpeedValues, shutterSpeedValues: ShutterSpeedValue.values,
isoValues: isoValues, isoValues: IsoValue.values,
); );
List<EquipmentProfileData> _customProfiles = []; List<EquipmentProfileData> _customProfiles = [];
@ -68,10 +68,10 @@ class EquipmentProfileProviderState extends State<EquipmentProfileProvider> {
_customProfiles.add(EquipmentProfileData( _customProfiles.add(EquipmentProfileData(
id: const Uuid().v1(), id: const Uuid().v1(),
name: name, name: name,
apertureValues: apertureValues, apertureValues: ApertureValue.values,
ndValues: ndValues, ndValues: NdValue.values,
shutterSpeedValues: shutterSpeedValues, shutterSpeedValues: ShutterSpeedValue.values,
isoValues: isoValues, isoValues: IsoValue.values,
)); ));
_refreshSavedProfiles(); _refreshSavedProfiles();
} }

View file

@ -106,7 +106,7 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
void _onFilmChanged(FilmChangedEvent event, Emitter emit) { void _onFilmChanged(FilmChangedEvent event, Emitter emit) {
if (_iso.value != event.data.iso) { if (_iso.value != event.data.iso) {
final newIso = isoValues.firstWhere( final newIso = IsoValue.values.firstWhere(
(e) => e.value == event.data.iso, (e) => e.value == event.data.iso,
orElse: () => _iso, orElse: () => _iso,
); );
@ -175,7 +175,7 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
const ShutterSpeedValue anchorShutterSpeed = ShutterSpeedValue(1, false, StopType.full); const ShutterSpeedValue anchorShutterSpeed = ShutterSpeedValue(1, false, StopType.full);
int anchorIndex = _shutterSpeedValues.indexOf(anchorShutterSpeed); int anchorIndex = _shutterSpeedValues.indexOf(anchorShutterSpeed);
if (anchorIndex < 0) { if (anchorIndex < 0) {
final filteredFullList = shutterSpeedValues.whereStopType(stopType); final filteredFullList = ShutterSpeedValue.values.whereStopType(stopType);
final customListStartIndex = filteredFullList.indexOf(_shutterSpeedValues.first); final customListStartIndex = filteredFullList.indexOf(_shutterSpeedValues.first);
final fullListAnchor = filteredFullList.indexOf(anchorShutterSpeed); final fullListAnchor = filteredFullList.indexOf(anchorShutterSpeed);
if (customListStartIndex < fullListAnchor) { if (customListStartIndex < fullListAnchor) {

View file

@ -35,8 +35,8 @@ class EquipmentListTiles extends StatelessWidget {
icon: Icons.iso, icon: Icons.iso,
title: S.of(context).isoValues, title: S.of(context).isoValues,
description: S.of(context).isoValuesFilterDescription, description: S.of(context).isoValuesFilterDescription,
values: isoValues, values: IsoValue.values,
valuesCount: selectedIsoValues.length == isoValues.length valuesCount: selectedIsoValues.length == IsoValue.values.length
? S.of(context).equipmentProfileAllValues ? S.of(context).equipmentProfileAllValues
: selectedIsoValues.length.toString(), : selectedIsoValues.length.toString(),
selectedValues: selectedIsoValues, selectedValues: selectedIsoValues,
@ -47,8 +47,8 @@ class EquipmentListTiles extends StatelessWidget {
icon: Icons.filter_b_and_w, icon: Icons.filter_b_and_w,
title: S.of(context).ndFilters, title: S.of(context).ndFilters,
description: S.of(context).ndFiltersFilterDescription, description: S.of(context).ndFiltersFilterDescription,
values: ndValues, values: NdValue.values,
valuesCount: selectedNdValues.length == ndValues.length valuesCount: selectedNdValues.length == NdValue.values.length
? S.of(context).equipmentProfileAllValues ? S.of(context).equipmentProfileAllValues
: selectedNdValues.length.toString(), : selectedNdValues.length.toString(),
selectedValues: selectedNdValues, selectedValues: selectedNdValues,
@ -59,8 +59,8 @@ class EquipmentListTiles extends StatelessWidget {
icon: Icons.camera, icon: Icons.camera,
title: S.of(context).apertureValues, title: S.of(context).apertureValues,
description: S.of(context).apertureValuesFilterDescription, description: S.of(context).apertureValuesFilterDescription,
values: apertureValues, values: ApertureValue.values,
valuesCount: selectedApertureValues.length == apertureValues.length valuesCount: selectedApertureValues.length == ApertureValue.values.length
? S.of(context).equipmentProfileAllValues ? S.of(context).equipmentProfileAllValues
: selectedApertureValues.length.toString(), : selectedApertureValues.length.toString(),
selectedValues: selectedApertureValues, selectedValues: selectedApertureValues,
@ -71,8 +71,8 @@ class EquipmentListTiles extends StatelessWidget {
icon: Icons.shutter_speed, icon: Icons.shutter_speed,
title: S.of(context).shutterSpeedValues, title: S.of(context).shutterSpeedValues,
description: S.of(context).shutterSpeedValuesFilterDescription, description: S.of(context).shutterSpeedValuesFilterDescription,
values: shutterSpeedValues, values: ShutterSpeedValue.values,
valuesCount: selectedShutterSpeedValues.length == shutterSpeedValues.length valuesCount: selectedShutterSpeedValues.length == ShutterSpeedValue.values.length
? S.of(context).equipmentProfileAllValues ? S.of(context).equipmentProfileAllValues
: selectedShutterSpeedValues.length.toString(), : selectedShutterSpeedValues.length.toString(),
selectedValues: selectedShutterSpeedValues, selectedValues: selectedShutterSpeedValues,