This commit is contained in:
Vadim 2023-05-07 12:17:01 +02:00
parent 3e5587a365
commit 423694a50c
4 changed files with 33 additions and 30 deletions

View file

@ -135,7 +135,11 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
_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);

View file

@ -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}',

View file

@ -44,20 +44,17 @@ class _MeteringScreenState extends State<MeteringScreen> {
children: [
Expanded(
child: BlocBuilder<MeteringBloc, MeteringState>(
buildWhen: (_, current) => current is MeteringDataState,
builder: (_, state) => state is MeteringDataState
? _MeteringContainerBuidler(
fastest: state.fastest,
slowest: state.slowest,
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)),
exposurePairs: state.exposurePairs,
)
: const SizedBox.shrink(),
),
),
),
BlocBuilder<MeteringBloc, MeteringState>(

View file

@ -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<ExposurePair> 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,
});