hide light sensor calibration on ios

This commit is contained in:
Vadim 2023-01-29 19:54:42 +03:00
parent c89776663f
commit b244f36a11
2 changed files with 23 additions and 15 deletions

View file

@ -28,7 +28,8 @@
"halfStops": "1/2", "halfStops": "1/2",
"thirdStops": "1/3", "thirdStops": "1/3",
"calibration": "Calibration", "calibration": "Calibration",
"calibrationMessage": "The accuracy of the readings measured by this application depends entirely on the hardware of the device. Therefore, consider testing this application and setting up an EV calibration value that will give you the desired measurement results.", "calibrationMessage": "The accuracy of the readings measured by this application depends entirely on the hardware of the device. Therefore, consider testing this application and setting up EV calibration values that will give you the desired measurement results.",
"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", "camera": "Camera",
"lightSensor": "Light sensor", "lightSensor": "Light sensor",
"general": "General", "general": "General",

View file

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:lightmeter/environment.dart';
import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/res/dimens.dart';
import 'package:lightmeter/screens/settings/components/calibration/components/calibration_dialog/event_dialog_calibration.dart'; import 'package:lightmeter/screens/settings/components/calibration/components/calibration_dialog/event_dialog_calibration.dart';
@ -14,6 +15,7 @@ class CalibrationDialog extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final bool hasLightSensor = context.read<Environment>().hasLightSensor;
return AlertDialog( return AlertDialog(
titlePadding: const EdgeInsets.fromLTRB( titlePadding: const EdgeInsets.fromLTRB(
Dimens.paddingL, Dimens.paddingL,
@ -27,7 +29,11 @@ class CalibrationDialog extends StatelessWidget {
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text(S.of(context).calibrationMessage), Text(
hasLightSensor
? S.of(context).calibrationMessage
: S.of(context).calibrationMessageCameraOnly,
),
const SizedBox(height: Dimens.grid16), const SizedBox(height: Dimens.grid16),
BlocBuilder<CalibrationDialogBloc, CalibrationDialogState>( BlocBuilder<CalibrationDialogBloc, CalibrationDialogState>(
buildWhen: (previous, current) => buildWhen: (previous, current) =>
@ -43,6 +49,7 @@ class CalibrationDialog extends StatelessWidget {
.add(const CameraEvCalibrationResetEvent()), .add(const CameraEvCalibrationResetEvent()),
), ),
), ),
if (hasLightSensor)
BlocBuilder<CalibrationDialogBloc, CalibrationDialogState>( BlocBuilder<CalibrationDialogBloc, CalibrationDialogState>(
buildWhen: (previous, current) => buildWhen: (previous, current) =>
previous.lightSensorEvCalibration != current.lightSensorEvCalibration, previous.lightSensorEvCalibration != current.lightSensorEvCalibration,