diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 978035e..e7c3eb8 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -28,7 +28,8 @@ "halfStops": "1/2", "thirdStops": "1/3", "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", "lightSensor": "Light sensor", "general": "General", diff --git a/lib/screens/settings/components/calibration/components/calibration_dialog/widget_dialog_calibration.dart b/lib/screens/settings/components/calibration/components/calibration_dialog/widget_dialog_calibration.dart index add029d..2b5c9b2 100644 --- a/lib/screens/settings/components/calibration/components/calibration_dialog/widget_dialog_calibration.dart +++ b/lib/screens/settings/components/calibration/components/calibration_dialog/widget_dialog_calibration.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:lightmeter/environment.dart'; import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/res/dimens.dart'; import 'package:lightmeter/screens/settings/components/calibration/components/calibration_dialog/event_dialog_calibration.dart'; @@ -14,6 +15,7 @@ class CalibrationDialog extends StatelessWidget { @override Widget build(BuildContext context) { + final bool hasLightSensor = context.read().hasLightSensor; return AlertDialog( titlePadding: const EdgeInsets.fromLTRB( Dimens.paddingL, @@ -27,7 +29,11 @@ class CalibrationDialog extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - Text(S.of(context).calibrationMessage), + Text( + hasLightSensor + ? S.of(context).calibrationMessage + : S.of(context).calibrationMessageCameraOnly, + ), const SizedBox(height: Dimens.grid16), BlocBuilder( buildWhen: (previous, current) => @@ -43,20 +49,21 @@ class CalibrationDialog extends StatelessWidget { .add(const CameraEvCalibrationResetEvent()), ), ), - BlocBuilder( - buildWhen: (previous, current) => - previous.lightSensorEvCalibration != current.lightSensorEvCalibration, - builder: (context, state) => _CalibrationUnit( - title: S.of(context).lightSensor, - value: state.lightSensorEvCalibration, - onChanged: (value) => context - .read() - .add(LightSensorEvCalibrationChangedEvent(value)), - onReset: () => context - .read() - .add(const LightSensorEvCalibrationResetEvent()), + if (hasLightSensor) + BlocBuilder( + buildWhen: (previous, current) => + previous.lightSensorEvCalibration != current.lightSensorEvCalibration, + builder: (context, state) => _CalibrationUnit( + title: S.of(context).lightSensor, + value: state.lightSensorEvCalibration, + onChanged: (value) => context + .read() + .add(LightSensorEvCalibrationChangedEvent(value)), + onReset: () => context + .read() + .add(const LightSensorEvCalibrationResetEvent()), + ), ), - ), ], ), ),