From c7af27e7cff19ed72633636d0df768c8e6355ed1 Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Mon, 22 Apr 2024 20:49:25 +0200 Subject: [PATCH] added manual shutter speed to equipment profiles --- lib/l10n/intl_en.arb | 4 +++- lib/l10n/intl_fr.arb | 2 ++ lib/l10n/intl_ru.arb | 2 ++ lib/l10n/intl_zh.arb | 2 ++ .../widget_list_tile_range_picker.dart | 20 +++++++++++++++++-- .../widget_container_equipment_profile.dart | 4 ++++ .../widget_dialog_picker_range.dart | 8 ++++---- 7 files changed, 35 insertions(+), 7 deletions(-) diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 46b8ad8..b041500 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -58,6 +58,8 @@ "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.", + "shutterSpeedManualShort": "B", + "shutterSpeedManual": "Manual", "isoValues": "ISO values", "isoValuesFilterDescription": "Select the ISO values to display. These may be your most commonly used values or those supported by your camera.", "lensZoom": "Lens zoom", @@ -116,4 +118,4 @@ "tooltipUseLightSensor": "Use lightsensor", "tooltipUseCamera": "Use camera", "tooltipOpenSettings": "Open settings" -} +} \ No newline at end of file diff --git a/lib/l10n/intl_fr.arb b/lib/l10n/intl_fr.arb index fd661a3..c3941ba 100644 --- a/lib/l10n/intl_fr.arb +++ b/lib/l10n/intl_fr.arb @@ -58,6 +58,8 @@ "ndFiltersFilterDescription": "Sélectionnez les filtres ND à afficher. Ce sont peut-être vos filtres ND les plus couramment utilisés ou ceux qui correspondent à votre lentille.", "shutterSpeedValues": "Valeurs de la vitesse d'obturation", "shutterSpeedValuesFilterDescription": "Sélectionnez la plage de valeurs de vitesse d'obturation à afficher. Cela est généralement déterminé par le corps de l'appareil que vous utilisez.", + "shutterSpeedManualShort": "B", + "shutterSpeedManual": "Manuelle", "isoValues": "Valeurs ISO", "isoValuesFilterDescription": "Sélectionnez les valeurs ISO à afficher. Ce sont peut-être vos valeurs les plus couramment utilisées ou celles prises en charge par votre caméra.", "lensZoom": "Zoom sur l'objectif", diff --git a/lib/l10n/intl_ru.arb b/lib/l10n/intl_ru.arb index 4543e1f..ef182d8 100644 --- a/lib/l10n/intl_ru.arb +++ b/lib/l10n/intl_ru.arb @@ -58,6 +58,8 @@ "ndFiltersFilterDescription": "Выберите ND фильтры для отображения. Это могут быть наиболее часто используемые ND фильтры или фильтры, подходящие под ваш объектив.", "shutterSpeedValues": "Значения выдержки", "shutterSpeedValuesFilterDescription": "Выберите диапазон значений выдержки. Обычно ограничивается возможностями вашей камеры.", + "shutterSpeedManualShort": "B", + "shutterSpeedManual": "Ручная", "isoValues": "Значения ISO", "isoValuesFilterDescription": "Выберите значения ISO для отображения. Это может быть наиболее часто используемые значения или значения, поддерживаемые вашей камерой.", "lensZoom": "Зум объектива", diff --git a/lib/l10n/intl_zh.arb b/lib/l10n/intl_zh.arb index 8994e91..5d26833 100644 --- a/lib/l10n/intl_zh.arb +++ b/lib/l10n/intl_zh.arb @@ -58,6 +58,8 @@ "ndFiltersFilterDescription": "选择要显示的 ND 滤镜系数。可能是您最常用的 ND 滤镜,也可能是适合您镜头的减光镜。", "shutterSpeedValues": "快门速度", "shutterSpeedValuesFilterDescription": "选择要显示的快门速度范围。这通常由您使用的相机机身决定。", + "shutterSpeedManualShort": "B", + "shutterSpeedManual": "手册", "isoValues": "ISO", "isoValuesFilterDescription": "选择要显示的 ISO 。这些可能是您常用的ISO值,也可以是相机支持的ISO范围。", "lensZoom": "镜头变焦", diff --git a/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/range_picker_list_tile/widget_list_tile_range_picker.dart b/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/range_picker_list_tile/widget_list_tile_range_picker.dart index bad6081..95b2435 100644 --- a/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/range_picker_list_tile/widget_list_tile_range_picker.dart +++ b/lib/screens/settings/components/metering/components/equipment_profiles/components/equipment_profile_screen/components/equipment_profile_container/components/range_picker_list_tile/widget_list_tile_range_picker.dart @@ -8,6 +8,8 @@ class RangePickerListTile extends StatelessWidget { final String description; final List selectedValues; final List values; + final String Function(BuildContext context, T value)? trailingAdapter; + final String Function(BuildContext context, T value)? dialogValueAdapter; final ValueChanged> onChanged; const RangePickerListTile({ @@ -16,6 +18,8 @@ class RangePickerListTile extends StatelessWidget { required this.description, required this.selectedValues, required this.values, + this.trailingAdapter, + this.dialogValueAdapter, required this.onChanged, super.key, }); @@ -25,7 +29,7 @@ class RangePickerListTile extends StatelessWidget { return ListTile( leading: Icon(icon), title: Text(title), - trailing: Text("${selectedValues.first} - ${selectedValues.last}"), + trailing: Text(_trailing(context)), onTap: () { showDialog>( context: context, @@ -35,7 +39,7 @@ class RangePickerListTile extends StatelessWidget { description: description, values: values, selectedValues: selectedValues, - titleAdapter: (_, value) => value.toString(), + valueAdapter: (context, value) => dialogValueAdapter?.call(context, value) ?? value.toString(), ), ).then((values) { if (values != null) { @@ -45,4 +49,16 @@ class RangePickerListTile extends StatelessWidget { }, ); } + + String _trailing(BuildContext context) { + final buffer = StringBuffer(); + buffer.write(trailingAdapter?.call(context, selectedValues.first) ?? selectedValues.first); + if (selectedValues.first != selectedValues.last) { + buffer.writeAll([ + ' - ', + trailingAdapter?.call(context, selectedValues.last) ?? selectedValues.last, + ]); + } + return buffer.toString(); + } } 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 bb1cc72..8504c67 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 @@ -269,6 +269,10 @@ class _AnimatedEquipmentListTiles extends AnimatedWidget { values: ShutterSpeedValue.values, selectedValues: equipmentData.shutterSpeedValues, onChanged: onShutterSpeedValuesSelected, + trailingAdapter: (context, value) => + value.value == 1 ? S.of(context).shutterSpeedManualShort : value.toString(), + dialogValueAdapter: (context, value) => + value.value == 1 ? S.of(context).shutterSpeedManual : value.toString(), ), SliderPickerListTile( icon: Icons.zoom_in, diff --git a/lib/screens/settings/components/shared/dialog_range_picker/widget_dialog_picker_range.dart b/lib/screens/settings/components/shared/dialog_range_picker/widget_dialog_picker_range.dart index 56f7967..aedf1aa 100644 --- a/lib/screens/settings/components/shared/dialog_range_picker/widget_dialog_picker_range.dart +++ b/lib/screens/settings/components/shared/dialog_range_picker/widget_dialog_picker_range.dart @@ -9,7 +9,7 @@ class DialogRangePicker extends StatefulWidget { final String description; final List values; final List selectedValues; - final String Function(BuildContext context, T value) titleAdapter; + final String Function(BuildContext context, T value) valueAdapter; const DialogRangePicker({ required this.icon, @@ -17,7 +17,7 @@ class DialogRangePicker extends StatefulWidget { required this.description, required this.values, required this.selectedValues, - required this.titleAdapter, + required this.valueAdapter, super.key, }); @@ -52,8 +52,8 @@ class _DialogRangePickerState extends State