mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-22 15:30:59 +00:00
integrated EV value to measure button
This commit is contained in:
parent
f8391454b6
commit
a00d608adc
10 changed files with 53 additions and 19 deletions
|
@ -1,4 +1,7 @@
|
||||||
|
enum BuildType { dev, prod }
|
||||||
|
|
||||||
class Environment {
|
class Environment {
|
||||||
|
final BuildType buildType;
|
||||||
final String sourceCodeUrl;
|
final String sourceCodeUrl;
|
||||||
final String issuesReportUrl;
|
final String issuesReportUrl;
|
||||||
final String contactEmail;
|
final String contactEmail;
|
||||||
|
@ -6,6 +9,7 @@ class Environment {
|
||||||
final bool hasLightSensor;
|
final bool hasLightSensor;
|
||||||
|
|
||||||
const Environment({
|
const Environment({
|
||||||
|
required this.buildType,
|
||||||
required this.sourceCodeUrl,
|
required this.sourceCodeUrl,
|
||||||
required this.issuesReportUrl,
|
required this.issuesReportUrl,
|
||||||
required this.contactEmail,
|
required this.contactEmail,
|
||||||
|
@ -13,18 +17,21 @@ class Environment {
|
||||||
});
|
});
|
||||||
|
|
||||||
const Environment.dev()
|
const Environment.dev()
|
||||||
: sourceCodeUrl = 'https://github.com/vodemn/m3_lightmeter',
|
: buildType = BuildType.dev,
|
||||||
|
sourceCodeUrl = 'https://github.com/vodemn/m3_lightmeter',
|
||||||
issuesReportUrl = 'https://github.com/vodemn/m3_lightmeter/issues',
|
issuesReportUrl = 'https://github.com/vodemn/m3_lightmeter/issues',
|
||||||
contactEmail = 'contact.vodemn@gmail.com',
|
contactEmail = 'contact.vodemn@gmail.com',
|
||||||
hasLightSensor = false;
|
hasLightSensor = false;
|
||||||
|
|
||||||
const Environment.prod()
|
const Environment.prod()
|
||||||
: sourceCodeUrl = 'https://github.com/vodemn/m3_lightmeter',
|
: buildType = BuildType.prod,
|
||||||
|
sourceCodeUrl = 'https://github.com/vodemn/m3_lightmeter',
|
||||||
issuesReportUrl = 'https://github.com/vodemn/m3_lightmeter/issues',
|
issuesReportUrl = 'https://github.com/vodemn/m3_lightmeter/issues',
|
||||||
contactEmail = 'contact.vodemn@gmail.com',
|
contactEmail = 'contact.vodemn@gmail.com',
|
||||||
hasLightSensor = false;
|
hasLightSensor = false;
|
||||||
|
|
||||||
Environment copyWith({bool? hasLightSensor}) => Environment(
|
Environment copyWith({bool? hasLightSensor}) => Environment(
|
||||||
|
buildType: buildType,
|
||||||
sourceCodeUrl: sourceCodeUrl,
|
sourceCodeUrl: sourceCodeUrl,
|
||||||
issuesReportUrl: issuesReportUrl,
|
issuesReportUrl: issuesReportUrl,
|
||||||
contactEmail: contactEmail,
|
contactEmail: contactEmail,
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
"@@locale": "en",
|
"@@locale": "en",
|
||||||
"fastestExposurePair": "Fastest",
|
"fastestExposurePair": "Fastest",
|
||||||
"slowestExposurePair": "Slowest",
|
"slowestExposurePair": "Slowest",
|
||||||
"ev": "{value} EV",
|
"ev": "EV",
|
||||||
"@ev": {
|
"evValue": "{value} EV",
|
||||||
|
"@evValue": {
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
"value": {
|
"value": {
|
||||||
"type": "String"
|
"type": "String"
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
"@@locale": "fr",
|
"@@locale": "fr",
|
||||||
"fastestExposurePair": "Le plus rapide",
|
"fastestExposurePair": "Le plus rapide",
|
||||||
"slowestExposurePair": "Le plus lent",
|
"slowestExposurePair": "Le plus lent",
|
||||||
"ev": "{value} EV",
|
"ev": "EV",
|
||||||
"@ev": {
|
"evValue": "{value} EV",
|
||||||
|
"@evValue": {
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
"value": {
|
"value": {
|
||||||
"type": "String"
|
"type": "String"
|
||||||
|
|
|
@ -2,8 +2,9 @@
|
||||||
"@@locale": "ru",
|
"@@locale": "ru",
|
||||||
"fastestExposurePair": "Короткая выдержка",
|
"fastestExposurePair": "Короткая выдержка",
|
||||||
"slowestExposurePair": "Длинная выдержка",
|
"slowestExposurePair": "Длинная выдержка",
|
||||||
"ev": "{value} EV",
|
"ev": "EV",
|
||||||
"@ev": {
|
"evValue": "{value} EV",
|
||||||
|
"@evValue": {
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
"value": {
|
"value": {
|
||||||
"type": "String"
|
"type": "String"
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:lightmeter/generated/l10n.dart';
|
||||||
import 'package:lightmeter/res/dimens.dart';
|
import 'package:lightmeter/res/dimens.dart';
|
||||||
import 'package:lightmeter/screens/shared/filled_circle/widget_circle_filled.dart';
|
import 'package:lightmeter/screens/shared/filled_circle/widget_circle_filled.dart';
|
||||||
|
|
||||||
class MeteringMeasureButton extends StatefulWidget {
|
class MeteringMeasureButton extends StatefulWidget {
|
||||||
|
final double? ev;
|
||||||
final double size;
|
final double size;
|
||||||
final VoidCallback onTap;
|
final VoidCallback onTap;
|
||||||
|
|
||||||
const MeteringMeasureButton({
|
const MeteringMeasureButton({
|
||||||
required this.onTap,
|
required this.onTap,
|
||||||
|
required this.ev,
|
||||||
this.size = 72,
|
this.size = 72,
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
@ -55,6 +58,16 @@ class _MeteringMeasureButtonState extends State<MeteringMeasureButton> {
|
||||||
child: FilledCircle(
|
child: FilledCircle(
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
size: widget.size - Dimens.grid16,
|
size: widget.size - Dimens.grid16,
|
||||||
|
child: Center(
|
||||||
|
child: widget.ev != null
|
||||||
|
? Text(
|
||||||
|
'${widget.ev!.toStringAsFixed(1)}\n${S.of(context).ev}',
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||||
|
color: Theme.of(context).colorScheme.surface,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -4,11 +4,13 @@ import 'package:lightmeter/res/dimens.dart';
|
||||||
import 'widget_bottom_controls.dart';
|
import 'widget_bottom_controls.dart';
|
||||||
|
|
||||||
class MeteringBottomControlsProvider extends StatelessWidget {
|
class MeteringBottomControlsProvider extends StatelessWidget {
|
||||||
|
final double? ev;
|
||||||
final VoidCallback? onSwitchEvSourceType;
|
final VoidCallback? onSwitchEvSourceType;
|
||||||
final VoidCallback onMeasure;
|
final VoidCallback onMeasure;
|
||||||
final VoidCallback onSettings;
|
final VoidCallback onSettings;
|
||||||
|
|
||||||
const MeteringBottomControlsProvider({
|
const MeteringBottomControlsProvider({
|
||||||
|
required this.ev,
|
||||||
required this.onSwitchEvSourceType,
|
required this.onSwitchEvSourceType,
|
||||||
required this.onMeasure,
|
required this.onMeasure,
|
||||||
required this.onSettings,
|
required this.onSettings,
|
||||||
|
@ -30,6 +32,7 @@ class MeteringBottomControlsProvider extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: MeteringBottomControls(
|
child: MeteringBottomControls(
|
||||||
|
ev: ev,
|
||||||
onSwitchEvSourceType: onSwitchEvSourceType,
|
onSwitchEvSourceType: onSwitchEvSourceType,
|
||||||
onMeasure: onMeasure,
|
onMeasure: onMeasure,
|
||||||
onSettings: onSettings,
|
onSettings: onSettings,
|
||||||
|
|
|
@ -6,11 +6,13 @@ import 'package:provider/provider.dart';
|
||||||
import 'components/measure_button/widget_button_measure.dart';
|
import 'components/measure_button/widget_button_measure.dart';
|
||||||
|
|
||||||
class MeteringBottomControls extends StatelessWidget {
|
class MeteringBottomControls extends StatelessWidget {
|
||||||
|
final double? ev;
|
||||||
final VoidCallback? onSwitchEvSourceType;
|
final VoidCallback? onSwitchEvSourceType;
|
||||||
final VoidCallback onMeasure;
|
final VoidCallback onMeasure;
|
||||||
final VoidCallback onSettings;
|
final VoidCallback onSettings;
|
||||||
|
|
||||||
const MeteringBottomControls({
|
const MeteringBottomControls({
|
||||||
|
required this.ev,
|
||||||
required this.onSwitchEvSourceType,
|
required this.onSwitchEvSourceType,
|
||||||
required this.onMeasure,
|
required this.onMeasure,
|
||||||
required this.onSettings,
|
required this.onSettings,
|
||||||
|
@ -46,7 +48,10 @@ class MeteringBottomControls extends StatelessWidget {
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
MeteringMeasureButton(onTap: onMeasure),
|
MeteringMeasureButton(
|
||||||
|
ev: ev,
|
||||||
|
onTap: onMeasure,
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Center(
|
child: Center(
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
|
|
|
@ -83,9 +83,8 @@ class _PhotographyValuePickerDialogState<T extends PhotographyValue>
|
||||||
child: widget.itemTitleBuilder(context, widget.values[index]),
|
child: widget.itemTitleBuilder(context, widget.values[index]),
|
||||||
),
|
),
|
||||||
secondary: widget.values[index].value != _selectedValue.value
|
secondary: widget.values[index].value != _selectedValue.value
|
||||||
? Text(S
|
? Text(S.of(context).evValue(
|
||||||
.of(context)
|
widget.evDifferenceBuilder.call(_selectedValue, widget.values[index])))
|
||||||
.ev(widget.evDifferenceBuilder.call(_selectedValue, widget.values[index])))
|
|
||||||
: null,
|
: null,
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
|
|
|
@ -57,13 +57,17 @@ class _MeteringScreenState extends State<MeteringScreen> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
MeteringBottomControlsProvider(
|
BlocBuilder<MeteringBloc, MeteringState>(
|
||||||
|
buildWhen: (previous, current) => previous.ev != current.ev,
|
||||||
|
builder: (context, state) => MeteringBottomControlsProvider(
|
||||||
|
ev: context.read<Environment>().buildType == BuildType.dev ? state.ev : null,
|
||||||
onSwitchEvSourceType: context.read<Environment>().hasLightSensor
|
onSwitchEvSourceType: context.read<Environment>().hasLightSensor
|
||||||
? EvSourceTypeProvider.of(context).toggleType
|
? EvSourceTypeProvider.of(context).toggleType
|
||||||
: null,
|
: null,
|
||||||
onMeasure: () => _bloc.add(const MeasureEvent()),
|
onMeasure: () => _bloc.add(const MeasureEvent()),
|
||||||
onSettings: () => Navigator.pushNamed(context, 'settings'),
|
onSettings: () => Navigator.pushNamed(context, 'settings'),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -101,7 +101,7 @@ class _CalibrationUnit extends StatelessWidget {
|
||||||
ListTile(
|
ListTile(
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
title: Text(title),
|
title: Text(title),
|
||||||
trailing: Text(S.of(context).ev(value.toStringSignedAsFixed(1))),
|
trailing: Text(S.of(context).evValue(value.toStringSignedAsFixed(1))),
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
|
Loading…
Reference in a new issue