diff --git a/lib/data/models/supported_locale.dart b/lib/data/models/supported_locale.dart index e5f6dcb..445a30c 100644 --- a/lib/data/models/supported_locale.dart +++ b/lib/data/models/supported_locale.dart @@ -1,4 +1,4 @@ -enum SupportedLocale { en, fr, ru } +enum SupportedLocale { en, fr, ru, cn } extension SupportedLocaleExtension on SupportedLocale { String get intlName => toString().replaceAll("SupportedLocale.", ""); @@ -11,6 +11,8 @@ extension SupportedLocaleExtension on SupportedLocale { return 'Français'; case SupportedLocale.ru: return 'Русский'; + case SupportedLocale.cn: + return '<--->'; } } } diff --git a/lib/data/shared_prefs_service.dart b/lib/data/shared_prefs_service.dart index 76f9045..8105d5c 100644 --- a/lib/data/shared_prefs_service.dart +++ b/lib/data/shared_prefs_service.dart @@ -150,6 +150,6 @@ class UserPreferencesService { String get selectedEquipmentProfileId => ''; // coverage:ignore-line set selectedEquipmentProfileId(String id) {} // coverage:ignore-line - List get equipmentProfiles => []; // coverage:ignore-line - set equipmentProfiles(List profiles) {} // coverage:ignore-line + List get equipmentProfiles => []; // coverage:ignore-line + set equipmentProfiles(List profiles) {} // coverage:ignore-line } diff --git a/lib/providers/equipment_profile_provider.dart b/lib/providers/equipment_profile_provider.dart index c5ef82d..85c9377 100644 --- a/lib/providers/equipment_profile_provider.dart +++ b/lib/providers/equipment_profile_provider.dart @@ -4,8 +4,7 @@ import 'package:lightmeter/utils/inherited_generics.dart'; import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; import 'package:uuid/uuid.dart'; -typedef EquipmentProfiles = List; -typedef EquipmentProfile = EquipmentProfileData; +typedef EquipmentProfiles = List; class EquipmentProfileProvider extends StatefulWidget { final Widget child; @@ -21,7 +20,7 @@ class EquipmentProfileProvider extends StatefulWidget { } class EquipmentProfileProviderState extends State { - static const EquipmentProfileData _defaultProfile = EquipmentProfileData( + static const EquipmentProfile _defaultProfile = EquipmentProfile( id: '', name: '', apertureValues: ApertureValue.values, @@ -30,10 +29,10 @@ class EquipmentProfileProviderState extends State { isoValues: IsoValue.values, ); - List _customProfiles = []; + List _customProfiles = []; String _selectedId = ''; - EquipmentProfileData get _selectedProfile => _customProfiles.firstWhere( + EquipmentProfile get _selectedProfile => _customProfiles.firstWhere( (e) => e.id == _selectedId, orElse: () { context.get().selectedEquipmentProfileId = _defaultProfile.id; @@ -50,16 +49,16 @@ class EquipmentProfileProviderState extends State { @override Widget build(BuildContext context) { - return InheritedWidgetBase>( + return InheritedWidgetBase>( data: [_defaultProfile] + _customProfiles, - child: InheritedWidgetBase( + child: InheritedWidgetBase( data: _selectedProfile, child: widget.child, ), ); } - void setProfile(EquipmentProfileData data) { + void setProfile(EquipmentProfile data) { setState(() { _selectedId = data.id; }); @@ -69,7 +68,7 @@ class EquipmentProfileProviderState extends State { /// Creates a default equipment profile void addProfile(String name) { _customProfiles.add( - EquipmentProfileData( + EquipmentProfile( id: const Uuid().v1(), name: name, apertureValues: ApertureValue.values, @@ -81,7 +80,7 @@ class EquipmentProfileProviderState extends State { _refreshSavedProfiles(); } - void updateProdile(EquipmentProfileData data) { + void updateProdile(EquipmentProfile data) { final indexToUpdate = _customProfiles.indexWhere((element) => element.id == data.id); if (indexToUpdate >= 0) { _customProfiles[indexToUpdate] = data; @@ -89,7 +88,7 @@ class EquipmentProfileProviderState extends State { } } - void deleteProfile(EquipmentProfileData data) { + void deleteProfile(EquipmentProfile data) { _customProfiles.remove(data); _refreshSavedProfiles(); } diff --git a/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart b/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart index 09f8bce..0893305 100644 --- a/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart +++ b/lib/screens/metering/components/shared/readings_container/widget_container_readings.dart @@ -105,7 +105,7 @@ class _EquipmentProfilePicker extends StatelessWidget { @override Widget build(BuildContext context) { - return AnimatedDialogPicker( + return AnimatedDialogPicker( icon: Icons.camera, title: S.of(context).equipmentProfile, selectedValue: context.listen(), diff --git a/lib/screens/metering/event_metering.dart b/lib/screens/metering/event_metering.dart index 852b5e4..bf3a22d 100644 --- a/lib/screens/metering/event_metering.dart +++ b/lib/screens/metering/event_metering.dart @@ -6,7 +6,7 @@ sealed class MeteringEvent { } class EquipmentProfileChangedEvent extends MeteringEvent { - final EquipmentProfileData equipmentProfileData; + final EquipmentProfile equipmentProfileData; const EquipmentProfileChangedEvent(this.equipmentProfileData); } diff --git a/lib/screens/metering/screen_metering.dart b/lib/screens/metering/screen_metering.dart index 4fb1e85..bbfebfc 100644 --- a/lib/screens/metering/screen_metering.dart +++ b/lib/screens/metering/screen_metering.dart @@ -7,7 +7,6 @@ import 'package:lightmeter/data/models/exposure_pair.dart'; import 'package:lightmeter/data/models/film.dart'; import 'package:lightmeter/data/models/metering_screen_layout_config.dart'; import 'package:lightmeter/environment.dart'; -import 'package:lightmeter/providers/equipment_profile_provider.dart'; import 'package:lightmeter/providers/ev_source_type_provider.dart'; import 'package:lightmeter/screens/metering/bloc_metering.dart'; import 'package:lightmeter/screens/metering/components/bottom_controls/provider_bottom_controls.dart'; diff --git a/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/widget_container_equipment_profile.dart b/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/widget_container_equipment_profile.dart index b240611..1d9b7bf 100644 --- a/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/widget_container_equipment_profile.dart +++ b/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/widget_container_equipment_profile.dart @@ -8,8 +8,8 @@ import 'package:lightmeter/screens/settings/components/metering/components/equip import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; class EquipmentProfileContainer extends StatefulWidget { - final EquipmentProfileData data; - final ValueChanged onUpdate; + final EquipmentProfile data; + final ValueChanged onUpdate; final VoidCallback onDelete; final VoidCallback onExpand; @@ -27,7 +27,7 @@ class EquipmentProfileContainer extends StatefulWidget { class EquipmentProfileContainerState extends State with TickerProviderStateMixin { - late EquipmentProfileData _equipmentData = EquipmentProfileData( + late EquipmentProfile _equipmentData = EquipmentProfile( id: widget.data.id, name: widget.data.name, apertureValues: widget.data.apertureValues, @@ -45,7 +45,7 @@ class EquipmentProfileContainerState extends State @override void didUpdateWidget(EquipmentProfileContainer oldWidget) { super.didUpdateWidget(oldWidget); - _equipmentData = EquipmentProfileData( + _equipmentData = EquipmentProfile( id: widget.data.id, name: widget.data.name, apertureValues: widget.data.apertureValues, @@ -195,7 +195,7 @@ class _AnimatedArrowButton extends AnimatedWidget { } class _AnimatedEquipmentListTiles extends AnimatedWidget { - final EquipmentProfileData equipmentData; + final EquipmentProfile equipmentData; final ValueChanged> onApertureValuesSelected; final ValueChanged> onIsoValuesSelecred; final ValueChanged> onNdValuesSelected; diff --git a/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart b/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart index 25ca59a..4872d79 100644 --- a/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart +++ b/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/screen_equipment_profile.dart @@ -84,7 +84,7 @@ class _EquipmentProfilesScreenState extends State { }); } - void _updateProfileAt(EquipmentProfileData data, int index) { + void _updateProfileAt(EquipmentProfile data, int index) { EquipmentProfileProvider.of(context).updateProdile(data); } diff --git a/lib/screens/settings/components/metering/components/equipment_profiles/widget_list_tile_equipment_profiles.dart b/lib/screens/settings/components/metering/components/equipment_profiles/widget_list_tile_equipment_profiles.dart index 13cb6f0..d1a6ef3 100644 --- a/lib/screens/settings/components/metering/components/equipment_profiles/widget_list_tile_equipment_profiles.dart +++ b/lib/screens/settings/components/metering/components/equipment_profiles/widget_list_tile_equipment_profiles.dart @@ -12,7 +12,7 @@ class EquipmentProfilesListTile extends StatelessWidget { leading: const Icon(Icons.camera), title: Text(S.of(context).equipmentProfiles), onTap: () { - Navigator.of(context).push( + Navigator.of(context).push( MaterialPageRoute(builder: (_) => const EquipmentProfilesScreen()), ); }, diff --git a/test/screens/metering/bloc_metering_test.dart b/test/screens/metering/bloc_metering_test.dart index 3593c91..45b9291 100644 --- a/test/screens/metering/bloc_metering_test.dart +++ b/test/screens/metering/bloc_metering_test.dart @@ -495,7 +495,7 @@ void main() { group( '`EquipmentProfileChangedEvent`', () { - final reducedProfile = EquipmentProfileData( + final reducedProfile = EquipmentProfile( id: '0', name: 'Reduced', apertureValues: ApertureValue.values,