mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-25 08:50:40 +00:00
ML-53 Unsupported operation: Infinity or NaN toInt (#54)
added `isNan` & `isInfinite` checks
This commit is contained in:
parent
6232ad555a
commit
0583b07cb9
2 changed files with 11 additions and 0 deletions
|
@ -166,6 +166,10 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
|||
}
|
||||
|
||||
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
|
||||
final int evSteps = (ev * (stopType.index + 1)).round();
|
||||
|
||||
|
|
|
@ -92,6 +92,13 @@ class _EvValueText extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (ev.isNaN || ev.isInfinite) {
|
||||
return Icon(
|
||||
Icons.error,
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
);
|
||||
}
|
||||
|
||||
final theme = Theme.of(context);
|
||||
return Text(
|
||||
'${ev.toStringAsFixed(1)}\n${S.of(context).ev}',
|
||||
|
|
Loading…
Reference in a new issue