From eb57a08874780f99c8649b57df7c77ba138df6ea Mon Sep 17 00:00:00 2001 From: Vadim Date: Wed, 5 Apr 2023 22:08:13 +0300 Subject: [PATCH] fixed dependencies --- lib/data/shared_prefs_service.dart | 11 ++++++----- lib/providers/equipment_profile_provider.dart | 16 ++++++++-------- lib/screens/metering/bloc_metering.dart | 4 ++-- .../widget_list_tiles_equipments.dart | 16 ++++++++-------- 4 files changed, 24 insertions(+), 23 deletions(-) diff --git a/lib/data/shared_prefs_service.dart b/lib/data/shared_prefs_service.dart index 56e05bd..7109bc3 100644 --- a/lib/data/shared_prefs_service.dart +++ b/lib/data/shared_prefs_service.dart @@ -37,15 +37,15 @@ class UserPreferencesService { Future _migrateOldKeys() async { final legacyIsoIndex = _sharedPreferences.getInt("curIsoIndex"); if (legacyIsoIndex != null) { - iso = isoValues[legacyIsoIndex]; + iso = IsoValue.values[legacyIsoIndex]; await _sharedPreferences.remove("curIsoIndex"); } final legacyNdIndex = _sharedPreferences.getInt("curndIndex"); if (legacyNdIndex != null) { /// Legacy ND list has 1 extra value at the end, so this check is needed - if (legacyNdIndex < ndValues.length) { - ndFilter = ndValues[legacyNdIndex]; + if (legacyNdIndex < NdValue.values.length) { + ndFilter = NdValue.values[legacyNdIndex]; } await _sharedPreferences.remove("curndIndex"); } @@ -70,11 +70,11 @@ class UserPreferencesService { } 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); 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); EvSourceType get evSourceType => @@ -95,6 +95,7 @@ class UserPreferencesService { }; } } + set meteringScreenLayout(MeteringScreenLayoutConfig value) => _sharedPreferences.setString(_meteringScreenLayoutKey, json.encode(value.toJson())); diff --git a/lib/providers/equipment_profile_provider.dart b/lib/providers/equipment_profile_provider.dart index df38277..610ecd7 100644 --- a/lib/providers/equipment_profile_provider.dart +++ b/lib/providers/equipment_profile_provider.dart @@ -21,10 +21,10 @@ class EquipmentProfileProviderState extends State { static const EquipmentProfileData _defaultProfile = EquipmentProfileData( id: '', name: '', - apertureValues: apertureValues, - ndValues: ndValues, - shutterSpeedValues: shutterSpeedValues, - isoValues: isoValues, + apertureValues: ApertureValue.values, + ndValues: NdValue.values, + shutterSpeedValues: ShutterSpeedValue.values, + isoValues: IsoValue.values, ); List _customProfiles = []; @@ -68,10 +68,10 @@ class EquipmentProfileProviderState extends State { _customProfiles.add(EquipmentProfileData( id: const Uuid().v1(), name: name, - apertureValues: apertureValues, - ndValues: ndValues, - shutterSpeedValues: shutterSpeedValues, - isoValues: isoValues, + apertureValues: ApertureValue.values, + ndValues: NdValue.values, + shutterSpeedValues: ShutterSpeedValue.values, + isoValues: IsoValue.values, )); _refreshSavedProfiles(); } diff --git a/lib/screens/metering/bloc_metering.dart b/lib/screens/metering/bloc_metering.dart index 8f3dc98..3f78928 100644 --- a/lib/screens/metering/bloc_metering.dart +++ b/lib/screens/metering/bloc_metering.dart @@ -106,7 +106,7 @@ class MeteringBloc extends Bloc { void _onFilmChanged(FilmChangedEvent event, Emitter emit) { if (_iso.value != event.data.iso) { - final newIso = isoValues.firstWhere( + final newIso = IsoValue.values.firstWhere( (e) => e.value == event.data.iso, orElse: () => _iso, ); @@ -175,7 +175,7 @@ class MeteringBloc extends Bloc { const ShutterSpeedValue anchorShutterSpeed = ShutterSpeedValue(1, false, StopType.full); int anchorIndex = _shutterSpeedValues.indexOf(anchorShutterSpeed); if (anchorIndex < 0) { - final filteredFullList = shutterSpeedValues.whereStopType(stopType); + final filteredFullList = ShutterSpeedValue.values.whereStopType(stopType); final customListStartIndex = filteredFullList.indexOf(_shutterSpeedValues.first); final fullListAnchor = filteredFullList.indexOf(anchorShutterSpeed); if (customListStartIndex < fullListAnchor) { diff --git a/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/equipment_list_tiles/widget_list_tiles_equipments.dart b/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/equipment_list_tiles/widget_list_tiles_equipments.dart index 38f25e8..52a2960 100644 --- a/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/equipment_list_tiles/widget_list_tiles_equipments.dart +++ b/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/equipment_list_tiles/widget_list_tiles_equipments.dart @@ -35,8 +35,8 @@ class EquipmentListTiles extends StatelessWidget { icon: Icons.iso, title: S.of(context).isoValues, description: S.of(context).isoValuesFilterDescription, - values: isoValues, - valuesCount: selectedIsoValues.length == isoValues.length + values: IsoValue.values, + valuesCount: selectedIsoValues.length == IsoValue.values.length ? S.of(context).equipmentProfileAllValues : selectedIsoValues.length.toString(), selectedValues: selectedIsoValues, @@ -47,8 +47,8 @@ class EquipmentListTiles extends StatelessWidget { icon: Icons.filter_b_and_w, title: S.of(context).ndFilters, description: S.of(context).ndFiltersFilterDescription, - values: ndValues, - valuesCount: selectedNdValues.length == ndValues.length + values: NdValue.values, + valuesCount: selectedNdValues.length == NdValue.values.length ? S.of(context).equipmentProfileAllValues : selectedNdValues.length.toString(), selectedValues: selectedNdValues, @@ -59,8 +59,8 @@ class EquipmentListTiles extends StatelessWidget { icon: Icons.camera, title: S.of(context).apertureValues, description: S.of(context).apertureValuesFilterDescription, - values: apertureValues, - valuesCount: selectedApertureValues.length == apertureValues.length + values: ApertureValue.values, + valuesCount: selectedApertureValues.length == ApertureValue.values.length ? S.of(context).equipmentProfileAllValues : selectedApertureValues.length.toString(), selectedValues: selectedApertureValues, @@ -71,8 +71,8 @@ class EquipmentListTiles extends StatelessWidget { icon: Icons.shutter_speed, title: S.of(context).shutterSpeedValues, description: S.of(context).shutterSpeedValuesFilterDescription, - values: shutterSpeedValues, - valuesCount: selectedShutterSpeedValues.length == shutterSpeedValues.length + values: ShutterSpeedValue.values, + valuesCount: selectedShutterSpeedValues.length == ShutterSpeedValue.values.length ? S.of(context).equipmentProfileAllValues : selectedShutterSpeedValues.length.toString(), selectedValues: selectedShutterSpeedValues,