added isNan & isInfinite checks

This commit is contained in:
Vadim 2023-05-04 12:46:46 +02:00
parent 6232ad555a
commit e166302dd6
2 changed files with 11 additions and 0 deletions

View file

@ -166,6 +166,10 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
} }
List<ExposurePair> _buildExposureValues(double ev) { List<ExposurePair> _buildExposureValues(double ev) {
if (ev.isNaN || ev.isInfinite) {
return List.empty(growable: false);
}
/// Depending on the `stopType` the exposure pairs list length is multiplied by 1,2 or 3 /// Depending on the `stopType` the exposure pairs list length is multiplied by 1,2 or 3
final int evSteps = (ev * (stopType.index + 1)).round(); final int evSteps = (ev * (stopType.index + 1)).round();

View file

@ -92,6 +92,13 @@ class _EvValueText extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (ev.isNaN || ev.isInfinite) {
return Icon(
Icons.error,
color: Theme.of(context).colorScheme.surface,
);
}
final theme = Theme.of(context); final theme = Theme.of(context);
return Text( return Text(
'${ev.toStringAsFixed(1)}\n${S.of(context).ev}', '${ev.toStringAsFixed(1)}\n${S.of(context).ev}',