integrated EV100 setting to UI

This commit is contained in:
Vadim 2024-01-15 14:27:27 +01:00
parent 33f1a84910
commit abd33ed963
10 changed files with 56 additions and 3 deletions

View file

@ -34,6 +34,7 @@
"calibrationMessageCameraOnly": "The accuracy of the readings measured by this application depends entirely on the rear camera of the device. Therefore, consider testing this application and setting up an EV calibration value that will give you the desired measurement results.",
"camera": "Camera",
"lightSensor": "Light sensor",
"showEv100": "Show EV\u2081\u2080\u2080",
"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.",
"meteringScreenLayoutHintEquipmentProfiles": "Equipment profile picker",

View file

@ -34,6 +34,7 @@
"calibrationMessageCameraOnly": "La précision des lectures mesurées par cette application dépend entièrement de la caméra arrière de l'appareil. Par conséquent, envisagez de tester cette application et de configurer une valeur d'étalonnage EV qui vous donnera les résultats de mesure souhaités.",
"camera": "Caméra",
"lightSensor": "Capteur de lumière",
"showEv100": "Montrer EV\u2081\u2080\u2080",
"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.",
"meteringScreenLayoutHintEquipmentProfiles": "Sélecteur de profil de l'équipement",

View file

@ -34,6 +34,7 @@
"calibrationMessageCameraOnly": "Точность измерений данного приложения полностью зависит от точности камеры вашего устройства. Поэтому рекомендуется самостоятельно подобрать калибровочное значение, которое даст желаемый результат измерений.",
"camera": "Камера",
"lightSensor": "Датчик освещённости",
"showEv100": "Показывать EV\u2081\u2080\u2080",
"meteringScreenLayout": "Элементы главного экрана",
"meteringScreenLayoutHint": "Здесь вы можете скрыть некоторые ненужные или неиспользуемые элементы с главного экрана.",
"meteringScreenLayoutHintEquipmentProfiles": "Выбор профиля оборудования",

View file

@ -34,6 +34,7 @@
"calibrationMessageCameraOnly": "此应用程序测量读数的准确s性完全取决于设备的后置摄像头。因此请考虑测试此应用并手动设置 EV 校准,以获得准确的测量结果。",
"camera": "摄像头",
"lightSensor": "光传感器",
"showEv100": "显示 EV\u2081\u2080\u2080",
"meteringScreenLayout": "布局",
"meteringScreenLayoutHint": "隐藏不需要的元素,以免浪费曝光列表空间",
"meteringScreenLayoutHintEquipmentProfiles": "设备配置选择",

View file

@ -1,15 +1,20 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/providers/user_preferences_provider.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/shared/filled_circle/widget_circle_filled.dart';
const String _subscript100 = '\u2081\u2080\u2080';
class MeteringMeasureButton extends StatefulWidget {
final double? ev;
final double? ev100;
final bool isMetering;
final VoidCallback onTap;
const MeteringMeasureButton({
required this.ev,
required this.ev100,
required this.isMetering,
required this.onTap,
super.key,
@ -61,7 +66,7 @@ class _MeteringMeasureButtonState extends State<MeteringMeasureButton> {
color: Theme.of(context).colorScheme.onSurface,
size: Dimens.grid72 - Dimens.grid8,
child: Center(
child: widget.ev != null ? _EvValueText(ev: widget.ev!) : null,
child: widget.ev != null ? _EvValueText(ev: widget.ev!, ev100: widget.ev100!) : null,
),
),
),
@ -83,16 +88,32 @@ class _MeteringMeasureButtonState extends State<MeteringMeasureButton> {
class _EvValueText extends StatelessWidget {
final double ev;
final double ev100;
const _EvValueText({required this.ev});
const _EvValueText({
required this.ev,
required this.ev100,
});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Text(
'${ev.toStringAsFixed(1)}\n${S.of(context).ev}',
_text(context),
style: theme.textTheme.bodyMedium?.copyWith(color: theme.colorScheme.surface),
textAlign: TextAlign.center,
);
}
String _text(BuildContext context) {
final bool showEv100 = UserPreferencesProvider.showEv100Of(context);
final StringBuffer buffer = StringBuffer()
..writeAll([
(showEv100 ? ev100 : ev).toStringAsFixed(1),
'\n',
S.of(context).ev,
if (showEv100) _subscript100,
]);
return buffer.toString();
}
}

View file

@ -5,6 +5,7 @@ import 'package:lightmeter/screens/metering/components/bottom_controls/widget_bo
class MeteringBottomControlsProvider extends StatelessWidget {
final double? ev;
final double? ev100;
final bool isMetering;
final VoidCallback? onSwitchEvSourceType;
final VoidCallback onMeasure;
@ -12,6 +13,7 @@ class MeteringBottomControlsProvider extends StatelessWidget {
const MeteringBottomControlsProvider({
required this.ev,
required this.ev100,
required this.isMetering,
required this.onSwitchEvSourceType,
required this.onMeasure,
@ -35,6 +37,7 @@ class MeteringBottomControlsProvider extends StatelessWidget {
),
child: MeteringBottomControls(
ev: ev,
ev100: ev100,
isMetering: isMetering,
onSwitchEvSourceType: onSwitchEvSourceType,
onMeasure: onMeasure,

View file

@ -7,6 +7,7 @@ import 'package:lightmeter/screens/metering/components/bottom_controls/component
class MeteringBottomControls extends StatelessWidget {
final double? ev;
final double? ev100;
final bool isMetering;
final VoidCallback? onSwitchEvSourceType;
final VoidCallback onMeasure;
@ -14,6 +15,7 @@ class MeteringBottomControls extends StatelessWidget {
const MeteringBottomControls({
required this.ev,
required this.ev100,
required this.isMetering,
required this.onSwitchEvSourceType,
required this.onMeasure,
@ -58,6 +60,7 @@ class MeteringBottomControls extends StatelessWidget {
const Spacer(),
MeteringMeasureButton(
ev: ev,
ev100: ev100,
isMetering: isMetering,
onTap: onMeasure,
),

View file

@ -40,6 +40,7 @@ class MeteringScreen extends StatelessWidget {
BlocBuilder<MeteringBloc, MeteringState>(
builder: (context, state) => MeteringBottomControlsProvider(
ev: state is MeteringDataState ? state.ev : null,
ev100: state is MeteringDataState ? state.ev100 : null,
isMetering: state.isMetering,
onSwitchEvSourceType: ServicesProvider.of(context).environment.hasLightSensor
? UserPreferencesProvider.of(context).toggleEvSourceType

View file

@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/providers/user_preferences_provider.dart';
import 'package:lightmeter/res/dimens.dart';
class ShowEv100ListTile extends StatelessWidget {
const ShowEv100ListTile({super.key});
@override
Widget build(BuildContext context) {
return SwitchListTile(
secondary: const Icon(Icons.adjust),
title: Text(S.of(context).showEv100),
value: UserPreferencesProvider.showEv100Of(context),
onChanged: (_) => UserPreferencesProvider.of(context).toggleShowEV100(),
contentPadding: const EdgeInsets.symmetric(horizontal: Dimens.paddingM),
);
}
}

View file

@ -6,6 +6,7 @@ import 'package:lightmeter/screens/settings/components/metering/components/equip
import 'package:lightmeter/screens/settings/components/metering/components/films/widget_list_tile_films.dart';
import 'package:lightmeter/screens/settings/components/metering/components/fractional_stops/widget_list_tile_fractional_stops.dart';
import 'package:lightmeter/screens/settings/components/metering/components/metering_screen_layout/widget_list_tile_metering_screen_layout.dart';
import 'package:lightmeter/screens/settings/components/metering/components/show_ev_100/widget_list_tile_show_ev_100.dart';
import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart';
class MeteringSettingsSection extends StatelessWidget {
@ -18,6 +19,7 @@ class MeteringSettingsSection extends StatelessWidget {
children: const [
StopTypeListTile(),
CalibrationListTile(),
ShowEv100ListTile(),
MeteringScreenLayoutListTile(),
EquipmentProfilesListTile(),
FilmsListTile(),