From 423694a50cca33a3025624b70dfa269db3c71078 Mon Sep 17 00:00:00 2001 From: Vadim Date: Sun, 7 May 2023 12:17:01 +0200 Subject: [PATCH] wip --- lib/screens/metering/bloc_metering.dart | 6 ++++- .../measure_button/widget_button_measure.dart | 7 ------ lib/screens/metering/screen_metering.dart | 25 ++++++++----------- lib/screens/metering/state_metering.dart | 25 +++++++++++++------ 4 files changed, 33 insertions(+), 30 deletions(-) diff --git a/lib/screens/metering/bloc_metering.dart b/lib/screens/metering/bloc_metering.dart index f4bcf69..13e38df 100644 --- a/lib/screens/metering/bloc_metering.dart +++ b/lib/screens/metering/bloc_metering.dart @@ -135,7 +135,11 @@ class MeteringBloc extends Bloc { _meteringInteractor.quickVibration(); _communicationBloc.add(const communication_events.MeasureEvent()); _isMeteringInProgress = true; - emit(const LoadingState()); + emit(LoadingState( + film: _film, + iso: _iso, + nd: _nd, + )); } void _updateMeasurements() => _handleEv100(_ev100); diff --git a/lib/screens/metering/components/bottom_controls/components/measure_button/widget_button_measure.dart b/lib/screens/metering/components/bottom_controls/components/measure_button/widget_button_measure.dart index 4e2ec61..cf3aa23 100644 --- a/lib/screens/metering/components/bottom_controls/components/measure_button/widget_button_measure.dart +++ b/lib/screens/metering/components/bottom_controls/components/measure_button/widget_button_measure.dart @@ -98,13 +98,6 @@ 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}', diff --git a/lib/screens/metering/screen_metering.dart b/lib/screens/metering/screen_metering.dart index 66f2445..f3c6b22 100644 --- a/lib/screens/metering/screen_metering.dart +++ b/lib/screens/metering/screen_metering.dart @@ -44,20 +44,17 @@ class _MeteringScreenState extends State { children: [ Expanded( child: BlocBuilder( - buildWhen: (_, current) => current is MeteringDataState, - builder: (_, state) => state is MeteringDataState - ? _MeteringContainerBuidler( - fastest: state.fastest, - slowest: state.slowest, - film: state.film, - iso: state.iso, - nd: state.nd, - onFilmChanged: (value) => _bloc.add(FilmChangedEvent(value)), - onIsoChanged: (value) => _bloc.add(IsoChangedEvent(value)), - onNdChanged: (value) => _bloc.add(NdChangedEvent(value)), - exposurePairs: state.exposurePairs, - ) - : const SizedBox.shrink(), + builder: (_, state) => _MeteringContainerBuidler( + fastest: state is MeteringDataState ? state.fastest : null, + slowest: state is MeteringDataState ? state.slowest : null, + exposurePairs: state is MeteringDataState ? state.exposurePairs : [], + film: state.film, + iso: state.iso, + nd: state.nd, + onFilmChanged: (value) => _bloc.add(FilmChangedEvent(value)), + onIsoChanged: (value) => _bloc.add(IsoChangedEvent(value)), + onNdChanged: (value) => _bloc.add(NdChangedEvent(value)), + ), ), ), BlocBuilder( diff --git a/lib/screens/metering/state_metering.dart b/lib/screens/metering/state_metering.dart index 17e192b..52dcf7a 100644 --- a/lib/screens/metering/state_metering.dart +++ b/lib/screens/metering/state_metering.dart @@ -5,26 +5,35 @@ import 'package:m3_lightmeter_resources/m3_lightmeter_resources.dart'; @immutable abstract class MeteringState { - const MeteringState(); + final Film film; + final IsoValue iso; + final NdValue nd; + + const MeteringState({ + required this.film, + required this.iso, + required this.nd, + }); } class LoadingState extends MeteringState { - const LoadingState(); + const LoadingState({ + required super.film, + required super.iso, + required super.nd, + }); } class MeteringDataState extends MeteringState { final double? ev; - final Film film; - final IsoValue iso; - final NdValue nd; final List exposurePairs; final bool continuousMetering; const MeteringDataState({ required this.ev, - required this.film, - required this.iso, - required this.nd, + required super.film, + required super.iso, + required super.nd, required this.exposurePairs, required this.continuousMetering, });