Equipment profiles issues (#115)

* update equipment profile from dialog

* updated `MeteringScreenLayoutFeaturesDialog` translations
This commit is contained in:
Vadim 2023-09-08 22:25:13 +02:00 committed by GitHub
parent 4201d36abb
commit cf4373d854
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 16 deletions

View file

@ -36,6 +36,7 @@
"lightSensor": "Light sensor", "lightSensor": "Light sensor",
"meteringScreenLayout": "Metering screen layout", "meteringScreenLayout": "Metering screen layout",
"meteringScreenLayoutHint": "Hide elements on the metering screen that you don't need so that they don't waste exposure pairs list space.", "meteringScreenLayoutHint": "Hide elements on the metering screen that you don't need so that they don't waste exposure pairs list space.",
"meteringScreenLayoutHintEquipmentProfiles": "Equipment profile picker",
"meteringScreenFeatureExtremeExposurePairs": "Fastest & shortest exposure pairs", "meteringScreenFeatureExtremeExposurePairs": "Fastest & shortest exposure pairs",
"meteringScreenFeatureFilmPicker": "Film picker", "meteringScreenFeatureFilmPicker": "Film picker",
"meteringScreenFeatureHistogram": "Histogram", "meteringScreenFeatureHistogram": "Histogram",

View file

@ -36,6 +36,7 @@
"lightSensor": "Capteur de lumière", "lightSensor": "Capteur de lumière",
"meteringScreenLayout": "Disposition de l'écran de mesure", "meteringScreenLayout": "Disposition de l'écran de mesure",
"meteringScreenLayoutHint": "Masquer les éléments sur l'écran de mesure dont vous n'avez pas besoin pour qu'ils ne gaspillent pas de l'espace dans les paires d'exposition.", "meteringScreenLayoutHint": "Masquer les éléments sur l'écran de mesure dont vous n'avez pas besoin pour qu'ils ne gaspillent pas de l'espace dans les paires d'exposition.",
"meteringScreenLayoutHintEquipmentProfiles": "Sélecteur de profil de l'équipement",
"meteringScreenFeatureExtremeExposurePairs": "Paires d'exposition les plus rapides et les plus courtes", "meteringScreenFeatureExtremeExposurePairs": "Paires d'exposition les plus rapides et les plus courtes",
"meteringScreenFeatureFilmPicker": "Sélecteur de film", "meteringScreenFeatureFilmPicker": "Sélecteur de film",
"meteringScreenFeatureHistogram": "Histogramme", "meteringScreenFeatureHistogram": "Histogramme",

View file

@ -36,6 +36,7 @@
"lightSensor": "Датчик освещённости", "lightSensor": "Датчик освещённости",
"meteringScreenLayout": "Элементы главного экрана", "meteringScreenLayout": "Элементы главного экрана",
"meteringScreenLayoutHint": "Здесь вы можете скрыть некоторые ненужные или неиспользуемые элементы с главного экрана.", "meteringScreenLayoutHint": "Здесь вы можете скрыть некоторые ненужные или неиспользуемые элементы с главного экрана.",
"meteringScreenLayoutHintEquipmentProfiles": "Выбор профиля оборудования",
"meteringScreenFeatureExtremeExposurePairs": "Длинная и короткая выдержки", "meteringScreenFeatureExtremeExposurePairs": "Длинная и короткая выдержки",
"meteringScreenFeatureFilmPicker": "Выбор пленки", "meteringScreenFeatureFilmPicker": "Выбор пленки",
"meteringScreenFeatureHistogram": "Гистограмма", "meteringScreenFeatureHistogram": "Гистограмма",

View file

@ -36,6 +36,7 @@
"lightSensor": "光传感器", "lightSensor": "光传感器",
"meteringScreenLayout": "布局", "meteringScreenLayout": "布局",
"meteringScreenLayoutHint": "隐藏不需要的元素,以免浪费曝光列表空间", "meteringScreenLayoutHint": "隐藏不需要的元素,以免浪费曝光列表空间",
"meteringScreenLayoutHintEquipmentProfiles": "设备配置选择",
"meteringScreenFeatureExtremeExposurePairs": "最快 & 最慢曝光组合", "meteringScreenFeatureExtremeExposurePairs": "最快 & 最慢曝光组合",
"meteringScreenFeatureFilmPicker": "胶片选择", "meteringScreenFeatureFilmPicker": "胶片选择",
"meteringScreenFeatureHistogram": "直方图", "meteringScreenFeatureHistogram": "直方图",

View file

@ -84,16 +84,8 @@ class _InheritedListeners extends StatelessWidget {
context.read<MeteringBloc>().add(const FilmChangedEvent(Film.other())); context.read<MeteringBloc>().add(const FilmChangedEvent(Film.other()));
} }
}, },
child: MeteringScreenLayoutFeatureListener(
feature: MeteringScreenLayoutFeature.equipmentProfiles,
onDidChangeDependencies: (value) {
if (!value) {
EquipmentProfileProvider.of(context).setProfile(EquipmentProfiles.of(context).first);
}
},
child: child, child: child,
), ),
),
); );
} }
} }

View file

@ -3,6 +3,7 @@ import 'package:lightmeter/data/models/metering_screen_layout_config.dart';
import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/providers/user_preferences_provider.dart'; import 'package:lightmeter/providers/user_preferences_provider.dart';
import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/res/dimens.dart';
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
class MeteringScreenLayoutFeaturesDialog extends StatefulWidget { class MeteringScreenLayoutFeaturesDialog extends StatefulWidget {
const MeteringScreenLayoutFeaturesDialog({super.key}); const MeteringScreenLayoutFeaturesDialog({super.key});
@ -25,20 +26,25 @@ class _MeteringScreenLayoutFeaturesDialogState extends State<MeteringScreenLayou
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
content: SizedBox( content: SizedBox(
width: double.maxFinite, width: double.maxFinite,
child: ListView( child: Column(
shrinkWrap: true, mainAxisSize: MainAxisSize.min,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: Dimens.paddingL), padding: const EdgeInsets.symmetric(horizontal: Dimens.paddingL),
child: Text(S.of(context).meteringScreenLayoutHint), child: Text(S.of(context).meteringScreenLayoutHint),
), ),
const SizedBox(height: Dimens.grid16), const SizedBox(height: Dimens.grid16),
ListView(
shrinkWrap: true,
children: [
_featureListTile(MeteringScreenLayoutFeature.equipmentProfiles), _featureListTile(MeteringScreenLayoutFeature.equipmentProfiles),
_featureListTile(MeteringScreenLayoutFeature.extremeExposurePairs), _featureListTile(MeteringScreenLayoutFeature.extremeExposurePairs),
_featureListTile(MeteringScreenLayoutFeature.filmPicker), _featureListTile(MeteringScreenLayoutFeature.filmPicker),
_featureListTile(MeteringScreenLayoutFeature.histogram), _featureListTile(MeteringScreenLayoutFeature.histogram),
], ],
), ),
],
),
), ),
actionsPadding: Dimens.dialogActionsPadding, actionsPadding: Dimens.dialogActionsPadding,
actions: [ actions: [
@ -48,6 +54,9 @@ class _MeteringScreenLayoutFeaturesDialogState extends State<MeteringScreenLayou
), ),
TextButton( TextButton(
onPressed: () { onPressed: () {
if (!_features[MeteringScreenLayoutFeature.equipmentProfiles]!) {
EquipmentProfileProvider.of(context).setProfile(EquipmentProfiles.of(context).first);
}
UserPreferencesProvider.of(context).setMeteringScreenLayout(_features); UserPreferencesProvider.of(context).setMeteringScreenLayout(_features);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
@ -73,7 +82,7 @@ class _MeteringScreenLayoutFeaturesDialogState extends State<MeteringScreenLayou
String _toStringLocalized(BuildContext context, MeteringScreenLayoutFeature feature) { String _toStringLocalized(BuildContext context, MeteringScreenLayoutFeature feature) {
switch (feature) { switch (feature) {
case MeteringScreenLayoutFeature.equipmentProfiles: case MeteringScreenLayoutFeature.equipmentProfiles:
return S.of(context).equipmentProfiles; return S.of(context).meteringScreenLayoutHintEquipmentProfiles;
case MeteringScreenLayoutFeature.extremeExposurePairs: case MeteringScreenLayoutFeature.extremeExposurePairs:
return S.of(context).meteringScreenFeatureExtremeExposurePairs; return S.of(context).meteringScreenFeatureExtremeExposurePairs;
case MeteringScreenLayoutFeature.filmPicker: case MeteringScreenLayoutFeature.filmPicker: