This commit is contained in:
Vadim 2023-05-16 09:42:48 +02:00
parent c8ab4a362e
commit 44fa4460fd
3 changed files with 28 additions and 23 deletions

View file

@ -132,11 +132,13 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
_meteringInteractor.quickVibration(); _meteringInteractor.quickVibration();
_communicationBloc.add(const communication_events.MeasureEvent()); _communicationBloc.add(const communication_events.MeasureEvent());
_isMeteringInProgress = true; _isMeteringInProgress = true;
emit(LoadingState( emit(
film: _film, LoadingState(
iso: _iso, film: _film,
nd: _nd, iso: _iso,
)); nd: _nd,
),
);
} }
void _updateMeasurements() => _handleEv100(_ev100); void _updateMeasurements() => _handleEv100(_ev100);
@ -153,27 +155,31 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
_meteringInteractor.responseVibration(); _meteringInteractor.responseVibration();
_ev100 = event.ev100; _ev100 = event.ev100;
final ev = event.ev100 + log2(_iso.value / 100) - _nd.stopReduction; final ev = event.ev100 + log2(_iso.value / 100) - _nd.stopReduction;
emit(MeteringDataState( emit(
ev: ev, MeteringDataState(
film: _film, ev: ev,
iso: _iso, film: _film,
nd: _nd, iso: _iso,
exposurePairs: _buildExposureValues(ev), nd: _nd,
continuousMetering: _isMeteringInProgress, exposurePairs: _buildExposureValues(ev),
)); continuousMetering: _isMeteringInProgress,
),
);
} }
void _onMeasureError(MeasureErrorEvent _, Emitter emit) { void _onMeasureError(MeasureErrorEvent _, Emitter emit) {
_meteringInteractor.errorVibration(); _meteringInteractor.errorVibration();
_ev100 = null; _ev100 = null;
emit(MeteringDataState( emit(
ev: null, MeteringDataState(
film: _film, ev: null,
iso: _iso, film: _film,
nd: _nd, iso: _iso,
exposurePairs: const [], nd: _nd,
continuousMetering: _isMeteringInProgress, exposurePairs: const [],
)); continuousMetering: _isMeteringInProgress,
),
);
} }
List<ExposurePair> _buildExposureValues(double ev) { List<ExposurePair> _buildExposureValues(double ev) {

View file

@ -193,7 +193,7 @@ class CameraContainerBloc extends EvSourceBlocBase<CameraContainerEvent, CameraC
final apertureValueRatio = (tags["EXIF FNumber"]?.values as IfdRatios?)?.ratios.first; final apertureValueRatio = (tags["EXIF FNumber"]?.values as IfdRatios?)?.ratios.first;
final speedValueRatio = (tags["EXIF ExposureTime"]?.values as IfdRatios?)?.ratios.first; final speedValueRatio = (tags["EXIF ExposureTime"]?.values as IfdRatios?)?.ratios.first;
if (iso == null || apertureValueRatio == null || speedValueRatio == null) { if (iso == null || apertureValueRatio == null || speedValueRatio == null) {
log('Error parsing EXIF: ${tags.keys.toString()}'); log('Error parsing EXIF: ${tags.keys}');
return null; return null;
} }

View file

@ -2,7 +2,6 @@ import 'package:clipboard/clipboard.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:lightmeter/environment.dart'; import 'package:lightmeter/environment.dart';
import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/res/dimens.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';