added focal length section

This commit is contained in:
Vadim 2025-02-17 21:39:02 +01:00
parent a7831b42e0
commit c8de7a4621
9 changed files with 45 additions and 19 deletions

View file

@ -305,7 +305,8 @@ Future<void> _expectMeteringState(
await tester.scrollToTheLastExposurePair(equipmentProfile: equipmentProfile);
expectExposurePairsListItem(tester, slowest.split(' - ')[0], slowest.split(' - ')[1]);
expectMeasureButton(ev);
expect(find.text(equipmentProfile.lensZoom.toZoom()), findsOneWidget);
final BuildContext context = tester.element(find.byType(IsoValuePicker));
expect(find.text(equipmentProfile.lensZoom.toZoom(context)), findsOneWidget);
}
Future<void> _expectMeteringStateAndMeasure(

View file

@ -45,6 +45,8 @@
"cameraFeatureSpotMeteringHint": "Long press the camera view to remove metering spot",
"cameraFeatureHistogram": "Histogram",
"cameraFeatureHistogramHint": "Enabling histogram can encrease battery drain",
"cameraFeaturesShowFocalLength": "Show Focal Length",
"cameraFeaturesShowFocalLengthHint": "Focal length will be determined after the first photo is taken",
"film": "Film",
"filmPush": "Film (push)",
"filmPull": "Film (pull)",

View file

@ -45,6 +45,8 @@
"cameraFeatureSpotMeteringHint": "Appuyez longuement sur la vue de l'appareil photo pour supprimer le spot de mesure",
"cameraFeatureHistogram": "Histogramme",
"cameraFeatureHistogramHint": "L'activation de l'histogramme peut augmenter la consommation de la batterie",
"cameraFeaturesShowFocalLength": "Afficher la focale",
"cameraFeaturesShowFocalLengthHint": "La focale sera déterminée après la première photo",
"film": "Pellicule",
"filmPush": "Pellicule (push)",
"filmPull": "Pellicule (pull)",

View file

@ -45,6 +45,8 @@
"cameraFeatureSpotMeteringHint": "Используйте долгое нажатие, чтобы удалить точку замера",
"cameraFeatureHistogram": "Гистограмма",
"cameraFeatureHistogramHint": "Использование гистограммы может увеличить расход аккумулятора",
"cameraFeaturesShowFocalLength": "Показать фокусное расстояние",
"cameraFeaturesShowFocalLengthHint": "Фокусное расстояние будет определено после первого снимка",
"film": "Пленка",
"filmPush": "Пленка (push)",
"filmPull": "Пленка (pull)",

View file

@ -45,6 +45,8 @@
"cameraFeatureSpotMeteringHint": "长按相机视图可移除测光点",
"cameraFeatureHistogram": "直方图",
"cameraFeatureHistogramHint": "启用直方图会增加电池消耗",
"cameraFeaturesShowFocalLength": "显示焦距",
"cameraFeaturesShowFocalLengthHint": "焦距将在拍摄第一张照片后确定",
"film": "胶片",
"filmPush": "胶片 (push)",
"filmPull": "胶片 (pull)",
@ -150,4 +152,4 @@
"filmFormulaExponentialRfPlaceholder": "1.3",
"addEquipmentProfileTitle": "添加设备",
"editEquipmentProfileTitle": "编辑设备"
}
}

View file

@ -246,7 +246,7 @@ class _LensZoomListTileBuilder extends StatelessWidget {
description: S.of(context).lensZoomDescription,
value: state.lensZoom,
range: const RangeValues(1, 7),
valueAdapter: (_, value) => value.toZoom(),
valueAdapter: (context, value) => value.toZoom(context),
onChanged: (value) {
context.read<EquipmentProfileEditBloc>().add(EquipmentProfileLensZoomChangedEvent(value));
},

View file

@ -35,7 +35,7 @@ class _ZoomSliderState extends State<ZoomSlider> {
icon: Icons.search_outlined,
defaultValue: EquipmentProfiles.selectedOf(context).lensZoom,
rulerValueAdapter: (value) => value.toStringAsFixed(0),
valueAdapter: (value) => value.toZoom(),
valueAdapter: (value) => value.toZoom(context),
);
}
}

View file

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/camera_feature.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/providers/services_provider.dart';
import 'package:lightmeter/providers/user_preferences_provider.dart';
import 'package:lightmeter/screens/settings/components/shared/dialog_switch/widget_dialog_switch.dart';
import 'package:lightmeter/screens/settings/components/shared/iap_list_tile/widget_list_tile_iap.dart';
@ -20,21 +21,21 @@ class CameraFeaturesListTile extends StatelessWidget {
icon: Icons.camera_alt_outlined,
title: S.of(context).cameraFeatures,
values: UserPreferencesProvider.cameraConfigOf(context),
titleAdapter: (context, feature) {
switch (feature) {
case CameraFeature.spotMetering:
return S.of(context).cameraFeatureSpotMetering;
case CameraFeature.histogram:
return S.of(context).cameraFeatureHistogram;
}
enabledAdapter: (feature) => switch (feature) {
CameraFeature.spotMetering => true,
CameraFeature.histogram => true,
CameraFeature.showFocalLength =>
ServicesProvider.of(context).userPreferencesService.cameraFocalLength != null,
},
subtitleAdapter: (context, feature) {
switch (feature) {
case CameraFeature.spotMetering:
return S.of(context).cameraFeatureSpotMeteringHint;
case CameraFeature.histogram:
return S.of(context).cameraFeatureHistogramHint;
}
titleAdapter: (context, feature) => switch (feature) {
CameraFeature.spotMetering => S.of(context).cameraFeatureSpotMetering,
CameraFeature.histogram => S.of(context).cameraFeatureHistogram,
CameraFeature.showFocalLength => S.of(context).cameraFeaturesShowFocalLength,
},
subtitleAdapter: (context, feature) => switch (feature) {
CameraFeature.spotMetering => S.of(context).cameraFeatureSpotMeteringHint,
CameraFeature.histogram => S.of(context).cameraFeatureHistogramHint,
CameraFeature.showFocalLength => S.of(context).cameraFeaturesShowFocalLengthHint,
},
onSave: UserPreferencesProvider.of(context).setCameraFeature,
),

View file

@ -1,3 +1,19 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/data/models/camera_feature.dart';
import 'package:lightmeter/providers/services_provider.dart';
import 'package:lightmeter/providers/user_preferences_provider.dart';
extension DoubleToZoom on double {
String toZoom() => 'x${toStringAsFixed(2)}';
String toZoom(BuildContext context) {
final showFocalLength = UserPreferencesProvider.cameraFeatureOf(context, CameraFeature.showFocalLength);
final cameraFocalLength = ServicesProvider.of(context).userPreferencesService.cameraFocalLength;
if (showFocalLength && cameraFocalLength != null) {
ServicesProvider.of(context).userPreferencesService.cameraFocalLength;
final zoomedFocalLength = (this * cameraFocalLength).round();
return '${zoomedFocalLength}mm';
} else {
return 'x${toStringAsFixed(2)}';
}
}
}