From c2a9730012ff953273dc056c1b733e866d628f92 Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Sat, 4 Mar 2023 00:04:58 +0300 Subject: [PATCH] removed equipment section --- lib/application.dart | 2 +- lib/l10n/intl_en.arb | 8 +- lib/providers/equipment_profile_provider.dart | 90 ------------------- .../widget_list_tile_equipment_profiles.dart | 14 --- .../widget_list_tile_iso_values.dart | 14 --- .../widget_list_tile_nd_filters.dart | 14 --- .../widget_settings_section_equipment.dart | 25 ------ .../widget_list_tile_equipment_profiles.dart | 41 +++++++++ .../widget_settings_section_metering.dart | 2 + lib/screens/settings/screen_settings.dart | 2 - 10 files changed, 51 insertions(+), 161 deletions(-) delete mode 100644 lib/providers/equipment_profile_provider.dart delete mode 100644 lib/screens/settings/components/equipment/components/equipment_profiles/widget_list_tile_equipment_profiles.dart delete mode 100644 lib/screens/settings/components/equipment/components/iso_values/widget_list_tile_iso_values.dart delete mode 100644 lib/screens/settings/components/equipment/components/nd_filters/widget_list_tile_nd_filters.dart delete mode 100644 lib/screens/settings/components/equipment/widget_settings_section_equipment.dart create mode 100644 lib/screens/settings/components/metering/components/equipment_profiles/widget_list_tile_equipment_profiles.dart diff --git a/lib/application.dart b/lib/application.dart index ed596a5..9c82a6d 100644 --- a/lib/application.dart +++ b/lib/application.dart @@ -8,6 +8,7 @@ import 'package:lightmeter/data/caffeine_service.dart'; import 'package:lightmeter/data/haptics_service.dart'; import 'package:lightmeter/data/models/supported_locale.dart'; import 'package:lightmeter/providers/supported_locale_provider.dart'; +import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart'; import 'package:provider/provider.dart'; import 'package:shared_preferences/shared_preferences.dart'; @@ -16,7 +17,6 @@ import 'data/permissions_service.dart'; import 'data/shared_prefs_service.dart'; import 'environment.dart'; import 'generated/l10n.dart'; -import 'providers/equipment_profile_provider.dart'; import 'providers/ev_source_type_provider.dart'; import 'providers/theme_provider.dart'; import 'screens/metering/flow_metering.dart'; diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 851228a..c279a18 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -35,8 +35,14 @@ "camera": "Camera", "lightSensor": "Light sensor", "equipment": "Equipment", - "isoValues": "ISO values", + "apertureValues": "Aperture values", + "apertureValuesFilterDescription": "Select the range of aperture values to display. This is usually determined by the lens you are using.", "ndFilters": "ND filters", + "ndFiltersFilterDescription": "Select the ND filters to display. These may be your most commonly used ND filters or the ones that fit your lens.", + "shutterSpeedValues": "Shutter speed values", + "shutterSpeedValuesFilterDescription": "Select the range of shutter speed values to display. This is usually determined by the camera body you are using.", + "isoValues": "ISO values", + "isoValuesFilterDescription": "Select the ISO values to display. These may be your most commonly used values or those supported by your camera.", "equipmentProfiles": "Equipment profiles", "general": "General", "keepScreenOn": "Keep screen on", diff --git a/lib/providers/equipment_profile_provider.dart b/lib/providers/equipment_profile_provider.dart deleted file mode 100644 index 9d12f2f..0000000 --- a/lib/providers/equipment_profile_provider.dart +++ /dev/null @@ -1,90 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:lightmeter/data/models/equipment_profile_data.dart'; -import 'package:lightmeter/data/models/photography_values/aperture_value.dart'; -import 'package:lightmeter/data/models/photography_values/iso_value.dart'; -import 'package:lightmeter/data/models/photography_values/nd_value.dart'; -import 'package:lightmeter/data/models/photography_values/shutter_speed_value.dart'; - -class EquipmentProfileProvider extends StatefulWidget { - final Widget child; - - const EquipmentProfileProvider({required this.child, super.key}); - - static EquipmentProfileProviderState of(BuildContext context) { - return context.findAncestorStateOfType()!; - } - - @override - State createState() => EquipmentProfileProviderState(); -} - -class EquipmentProfileProviderState extends State { - final List _profiles = [ - const EquipmentProfileData( - id: '0', - name: 'Default', - apertureValues: apertureValues, - ndValues: ndValues, - shutterSpeedValues: shutterSpeedValues, - isoValues: isoValues, - ), - ]; - late EquipmentProfileData? _selectedProfile = _profiles.isNotEmpty ? _profiles.first : null; - - @override - Widget build(BuildContext context) { - return EquipmentProfiles( - profiles: _profiles, - child: EquipmentProfile( - data: _selectedProfile, - child: widget.child, - ), - ); - } - - void setProfile(EquipmentProfileData data) { - setState(() { - _selectedProfile = data; - }); - } - - void addProfile(EquipmentProfileData data) {} - - void updateProdile(EquipmentProfileData data) {} - - void deleteProfile(EquipmentProfileData data) {} -} - -class EquipmentProfiles extends InheritedWidget { - final List profiles; - - const EquipmentProfiles({ - required this.profiles, - required super.child, - super.key, - }); - - static List? of(BuildContext context) { - return context.dependOnInheritedWidgetOfExactType()?.profiles; - } - - @override - bool updateShouldNotify(EquipmentProfiles oldWidget) => true; -} - -class EquipmentProfile extends InheritedWidget { - final EquipmentProfileData? data; - - const EquipmentProfile({ - required this.data, - required super.child, - super.key, - }); - - static EquipmentProfileData? of(BuildContext context) { - return context.dependOnInheritedWidgetOfExactType()?.data; - } - - @override - bool updateShouldNotify(EquipmentProfile oldWidget) => true; -} diff --git a/lib/screens/settings/components/equipment/components/equipment_profiles/widget_list_tile_equipment_profiles.dart b/lib/screens/settings/components/equipment/components/equipment_profiles/widget_list_tile_equipment_profiles.dart deleted file mode 100644 index a99140f..0000000 --- a/lib/screens/settings/components/equipment/components/equipment_profiles/widget_list_tile_equipment_profiles.dart +++ /dev/null @@ -1,14 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:lightmeter/generated/l10n.dart'; - -class EquipmentProfilesListTile extends StatelessWidget { - const EquipmentProfilesListTile({super.key}); - - @override - Widget build(BuildContext context) { - return ListTile( - leading: const Icon(Icons.camera), - title: Text(S.of(context).equipmentProfiles), - ); - } -} diff --git a/lib/screens/settings/components/equipment/components/iso_values/widget_list_tile_iso_values.dart b/lib/screens/settings/components/equipment/components/iso_values/widget_list_tile_iso_values.dart deleted file mode 100644 index 41f03f6..0000000 --- a/lib/screens/settings/components/equipment/components/iso_values/widget_list_tile_iso_values.dart +++ /dev/null @@ -1,14 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:lightmeter/generated/l10n.dart'; - -class IsoValuesListTile extends StatelessWidget { - const IsoValuesListTile({super.key}); - - @override - Widget build(BuildContext context) { - return ListTile( - leading: const Icon(Icons.iso), - title: Text(S.of(context).isoValues), - ); - } -} diff --git a/lib/screens/settings/components/equipment/components/nd_filters/widget_list_tile_nd_filters.dart b/lib/screens/settings/components/equipment/components/nd_filters/widget_list_tile_nd_filters.dart deleted file mode 100644 index 8599cc2..0000000 --- a/lib/screens/settings/components/equipment/components/nd_filters/widget_list_tile_nd_filters.dart +++ /dev/null @@ -1,14 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:lightmeter/generated/l10n.dart'; - -class NdFiltersListTile extends StatelessWidget { - const NdFiltersListTile({super.key}); - - @override - Widget build(BuildContext context) { - return ListTile( - leading: const Icon(Icons.filter_b_and_w), - title: Text(S.of(context).ndFilters), - ); - } -} diff --git a/lib/screens/settings/components/equipment/widget_settings_section_equipment.dart b/lib/screens/settings/components/equipment/widget_settings_section_equipment.dart deleted file mode 100644 index 179f288..0000000 --- a/lib/screens/settings/components/equipment/widget_settings_section_equipment.dart +++ /dev/null @@ -1,25 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:lightmeter/generated/l10n.dart'; -import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart'; - -import 'components/equipment_profiles/widget_list_tile_equipment_profiles.dart'; -import 'components/iso_values/widget_list_tile_iso_values.dart'; -import 'components/nd_filters/widget_list_tile_nd_filters.dart'; - - -class EquipmentSettingsSection extends StatelessWidget { - const EquipmentSettingsSection({super.key}); - - @override - Widget build(BuildContext context) { - return SettingsSection( - enabled: false, - title: S.of(context).equipment, - children: const [ - IsoValuesListTile(), - NdFiltersListTile(), - EquipmentProfilesListTile(), - ], - ); - } -} 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 new file mode 100644 index 0000000..4f01f07 --- /dev/null +++ b/lib/screens/settings/components/metering/components/equipment_profiles/widget_list_tile_equipment_profiles.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; +import 'package:lightmeter/generated/l10n.dart'; +import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart'; + +class EquipmentProfilesListTile extends StatelessWidget { + const EquipmentProfilesListTile({super.key}); + + @override + Widget build(BuildContext context) { + return ListTile( + leading: const Icon(Icons.camera), + title: Text(S.of(context).equipmentProfiles), + onTap: () { + showEquipmentProfilesDialog( + context, + EquipmentProfilesDialogLocalizationData( + title: S.of(context).equipmentProfiles, + addProfile: '', + equipmentProfileScreenLocalizationData: EquipmentProfileScreenLocalizationData( + isoValues: S.of(context).isoValues, + isoValuesFilterDescription: S.of(context).isoValuesFilterDescription, + ndValues: S.of(context).ndFilters, + ndValuesFilterDescription: S.of(context).ndFiltersFilterDescription, + apertureValues: S.of(context).apertureValues, + apertureValuesFilterDescription: S.of(context).apertureValuesFilterDescription, + shutterSpeedValues: S.of(context).shutterSpeedValues, + shutterSpeedValuesFilterDescription: + S.of(context).shutterSpeedValuesFilterDescription, + dialogFilterLocalizationData: DialogFilterLocalizationData( + cancel: S.of(context).cancel, + save: S.of(context).save, + ), + ), + cancel: S.of(context).cancel, + select: S.of(context).select, + ), + ); + }, + ); + } +} diff --git a/lib/screens/settings/components/metering/widget_settings_section_metering.dart b/lib/screens/settings/components/metering/widget_settings_section_metering.dart index d313597..db30e84 100644 --- a/lib/screens/settings/components/metering/widget_settings_section_metering.dart +++ b/lib/screens/settings/components/metering/widget_settings_section_metering.dart @@ -3,6 +3,7 @@ import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart'; import 'components/calibration/widget_list_tile_calibration.dart'; +import 'components/equipment_profiles/widget_list_tile_equipment_profiles.dart'; import 'components/fractional_stops/widget_list_tile_fractional_stops.dart'; class MeteringSettingsSection extends StatelessWidget { @@ -15,6 +16,7 @@ class MeteringSettingsSection extends StatelessWidget { children: const [ StopTypeListTile(), CalibrationListTile(), + EquipmentProfilesListTile(), ], ); } diff --git a/lib/screens/settings/screen_settings.dart b/lib/screens/settings/screen_settings.dart index 863d85d..6f225ff 100644 --- a/lib/screens/settings/screen_settings.dart +++ b/lib/screens/settings/screen_settings.dart @@ -3,7 +3,6 @@ import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/res/dimens.dart'; import 'components/about/widget_settings_section_about.dart'; -import 'components/equipment/widget_settings_section_equipment.dart'; import 'components/general/widget_settings_section_general.dart'; import 'components/metering/widget_settings_section_metering.dart'; import 'components/theme/widget_settings_section_theme.dart'; @@ -45,7 +44,6 @@ class SettingsScreen extends StatelessWidget { delegate: SliverChildListDelegate( [ const MeteringSettingsSection(), - const EquipmentSettingsSection(), const GeneralSettingsSection(), const ThemeSettingsSection(), const AboutSettingsSection(),