mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2025-02-22 12:30:40 +00:00
post-merge fixes
This commit is contained in:
parent
10bf463021
commit
9a51cb25ff
2 changed files with 38 additions and 43 deletions
|
@ -29,10 +29,18 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
||||||
EquipmentProfileData _equipmentProfileData;
|
EquipmentProfileData _equipmentProfileData;
|
||||||
StopType stopType;
|
StopType stopType;
|
||||||
|
|
||||||
late IsoValue _iso = _meteringInteractor.iso;
|
@visibleForTesting
|
||||||
late NdValue _nd = _meteringInteractor.ndFilter;
|
late IsoValue iso = _meteringInteractor.iso;
|
||||||
late Film _film = _meteringInteractor.film;
|
|
||||||
double? _ev100 = 0.0;
|
@visibleForTesting
|
||||||
|
late NdValue nd = _meteringInteractor.ndFilter;
|
||||||
|
|
||||||
|
@visibleForTesting
|
||||||
|
late Film film = _meteringInteractor.film;
|
||||||
|
|
||||||
|
@visibleForTesting
|
||||||
|
double? ev100 = 0.0;
|
||||||
|
|
||||||
bool _isMeteringInProgress = false;
|
bool _isMeteringInProgress = false;
|
||||||
|
|
||||||
MeteringBloc(
|
MeteringBloc(
|
||||||
|
@ -93,14 +101,14 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
||||||
/// doesn't contain currently selected value
|
/// doesn't contain currently selected value
|
||||||
if (!event.equipmentProfileData.isoValues.any((v) => iso.value == v.value)) {
|
if (!event.equipmentProfileData.isoValues.any((v) => iso.value == v.value)) {
|
||||||
_meteringInteractor.iso = event.equipmentProfileData.isoValues.first;
|
_meteringInteractor.iso = event.equipmentProfileData.isoValues.first;
|
||||||
_iso = event.equipmentProfileData.isoValues.first;
|
iso = event.equipmentProfileData.isoValues.first;
|
||||||
willUpdateMeasurements &= true;
|
willUpdateMeasurements &= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The same for ND filter
|
/// The same for ND filter
|
||||||
if (!event.equipmentProfileData.ndValues.any((v) => nd.value == v.value)) {
|
if (!event.equipmentProfileData.ndValues.any((v) => nd.value == v.value)) {
|
||||||
_meteringInteractor.ndFilter = event.equipmentProfileData.ndValues.first;
|
_meteringInteractor.ndFilter = event.equipmentProfileData.ndValues.first;
|
||||||
_nd = event.equipmentProfileData.ndValues.first;
|
nd = event.equipmentProfileData.ndValues.first;
|
||||||
willUpdateMeasurements &= true;
|
willUpdateMeasurements &= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,19 +118,20 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onFilmChanged(FilmChangedEvent event, Emitter emit) {
|
void _onFilmChanged(FilmChangedEvent event, Emitter emit) {
|
||||||
if (_film.name != event.data.name) {
|
if (film.name != event.data.name) {
|
||||||
|
film = event.data;
|
||||||
_meteringInteractor.film = event.data;
|
_meteringInteractor.film = event.data;
|
||||||
_film = event.data;
|
_film = event.data;
|
||||||
|
|
||||||
/// If user selects 'Other' film we preserve currently selected ISO
|
/// If user selects 'Other' film we preserve currently selected ISO
|
||||||
/// and therefore only discard reciprocity formula
|
/// and therefore only discard reciprocity formula
|
||||||
if (_iso.value != event.data.iso && event.data != const Film.other()) {
|
if (iso.value != event.data.iso && event.data != const Film.other()) {
|
||||||
final newIso = IsoValue.values.firstWhere(
|
final newIso = IsoValue.values.firstWhere(
|
||||||
(e) => e.value == event.data.iso,
|
(e) => e.value == event.data.iso,
|
||||||
orElse: () => _iso,
|
orElse: () => iso,
|
||||||
);
|
);
|
||||||
_meteringInteractor.iso = newIso;
|
_meteringInteractor.iso = newIso;
|
||||||
_iso = newIso;
|
iso = newIso;
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateMeasurements();
|
_updateMeasurements();
|
||||||
|
@ -136,17 +145,17 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
||||||
_meteringInteractor.film = Film.values.first;
|
_meteringInteractor.film = Film.values.first;
|
||||||
_film = Film.values.first;
|
_film = Film.values.first;
|
||||||
|
|
||||||
if (_iso != event.isoValue) {
|
if (iso != event.isoValue) {
|
||||||
_meteringInteractor.iso = event.isoValue;
|
_meteringInteractor.iso = event.isoValue;
|
||||||
_iso = event.isoValue;
|
iso = event.isoValue;
|
||||||
_updateMeasurements();
|
_updateMeasurements();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onNdChanged(NdChangedEvent event, Emitter emit) {
|
void _onNdChanged(NdChangedEvent event, Emitter emit) {
|
||||||
if (_nd != event.ndValue) {
|
if (nd != event.ndValue) {
|
||||||
_meteringInteractor.ndFilter = event.ndValue;
|
_meteringInteractor.ndFilter = event.ndValue;
|
||||||
_nd = event.ndValue;
|
nd = event.ndValue;
|
||||||
_updateMeasurements();
|
_updateMeasurements();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,14 +166,14 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
||||||
_isMeteringInProgress = true;
|
_isMeteringInProgress = true;
|
||||||
emit(
|
emit(
|
||||||
LoadingState(
|
LoadingState(
|
||||||
film: _film,
|
film: film,
|
||||||
iso: _iso,
|
iso: iso,
|
||||||
nd: _nd,
|
nd: nd,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _updateMeasurements() => _handleEv100(_ev100);
|
void _updateMeasurements() => _handleEv100(ev100);
|
||||||
|
|
||||||
void _handleEv100(double? ev100) {
|
void _handleEv100(double? ev100) {
|
||||||
if (ev100 == null || ev100.isNaN || ev100.isInfinite) {
|
if (ev100 == null || ev100.isNaN || ev100.isInfinite) {
|
||||||
|
@ -176,15 +185,15 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
||||||
|
|
||||||
void _onMeasured(MeasuredEvent event, Emitter emit) {
|
void _onMeasured(MeasuredEvent event, Emitter emit) {
|
||||||
_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(
|
emit(
|
||||||
MeteringDataState(
|
MeteringDataState(
|
||||||
ev: ev,
|
ev: ev,
|
||||||
film: _film,
|
film: film,
|
||||||
iso: _iso,
|
iso: iso,
|
||||||
nd: _nd,
|
nd: nd,
|
||||||
exposurePairs: _buildExposureValues(ev),
|
exposurePairs: buildExposureValues(ev),
|
||||||
continuousMetering: _isMeteringInProgress,
|
continuousMetering: _isMeteringInProgress,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -192,29 +201,17 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
||||||
|
|
||||||
void _onMeasureError(MeasureErrorEvent _, Emitter emit) {
|
void _onMeasureError(MeasureErrorEvent _, Emitter emit) {
|
||||||
_meteringInteractor.errorVibration();
|
_meteringInteractor.errorVibration();
|
||||||
_ev100 = null;
|
ev100 = null;
|
||||||
emit(
|
emit(
|
||||||
MeteringDataState(
|
MeteringDataState(
|
||||||
ev: null,
|
|
||||||
film: _film,
|
|
||||||
iso: _iso,
|
|
||||||
nd: _nd,
|
|
||||||
exposurePairs: const [],
|
|
||||||
continuousMetering: _isMeteringInProgress,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onMeasureError(MeasureErrorEvent _, Emitter emit) {
|
|
||||||
_meteringInteractor.errorVibration();
|
|
||||||
emit(MeteringDataState(
|
|
||||||
ev: null,
|
ev: null,
|
||||||
film: film,
|
film: film,
|
||||||
iso: iso,
|
iso: iso,
|
||||||
nd: nd,
|
nd: nd,
|
||||||
exposurePairs: const [],
|
exposurePairs: const [],
|
||||||
continuousMetering: isMeteringInProgress,
|
continuousMetering: _isMeteringInProgress,
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@visibleForTesting
|
@visibleForTesting
|
||||||
|
|
|
@ -8,6 +8,7 @@ environment:
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
app_settings: 4.2.0
|
app_settings: 4.2.0
|
||||||
|
bloc_concurrency: 0.2.2
|
||||||
camera: 0.10.5
|
camera: 0.10.5
|
||||||
clipboard: 0.1.3
|
clipboard: 0.1.3
|
||||||
dynamic_color: 1.6.5
|
dynamic_color: 1.6.5
|
||||||
|
@ -44,9 +45,6 @@ dev_dependencies:
|
||||||
mocktail: 0.3.0
|
mocktail: 0.3.0
|
||||||
test: 1.24.1
|
test: 1.24.1
|
||||||
|
|
||||||
dependency_overrides:
|
|
||||||
test_api: 0.4.16
|
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue