From c0e26b8840a738897eb631b608bedf060aaf99a1 Mon Sep 17 00:00:00 2001 From: Vadim <44135514+vodemn@users.noreply.github.com> Date: Sun, 17 Nov 2024 09:49:01 +0100 Subject: [PATCH] ML-196 Allow to select equipment profile in use (#199) * fixed equipment profile pickers updates --- .../bloc_equipment_profile_edit.dart | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/lib/screens/equipment_profile_edit/bloc_equipment_profile_edit.dart b/lib/screens/equipment_profile_edit/bloc_equipment_profile_edit.dart index 83ed0dd..0627bee 100644 --- a/lib/screens/equipment_profile_edit/bloc_equipment_profile_edit.dart +++ b/lib/screens/equipment_profile_edit/bloc_equipment_profile_edit.dart @@ -83,22 +83,42 @@ class EquipmentProfileEditBloc extends Bloc _onApertureValuesChanged(EquipmentProfileApertureValuesChangedEvent event, Emitter emit) async { _newEquipmentProfile = _newEquipmentProfile.copyWith(apertureValues: event.apertureValues); - emit(state.copyWith(apertureValues: event.apertureValues)); + emit( + state.copyWith( + apertureValues: event.apertureValues, + canSave: _canSave(state.name, state.lensZoom), + ), + ); } Future _onShutterSpeedValuesChanged(EquipmentProfileShutterSpeedValuesChangedEvent event, Emitter emit) async { _newEquipmentProfile = _newEquipmentProfile.copyWith(shutterSpeedValues: event.shutterSpeedValues); - emit(state.copyWith(shutterSpeedValues: event.shutterSpeedValues)); + emit( + state.copyWith( + shutterSpeedValues: event.shutterSpeedValues, + canSave: _canSave(state.name, state.lensZoom), + ), + ); } Future _onIsoValuesChanged(EquipmentProfileIsoValuesChangedEvent event, Emitter emit) async { _newEquipmentProfile = _newEquipmentProfile.copyWith(isoValues: event.isoValues); - emit(state.copyWith(isoValues: event.isoValues)); + emit( + state.copyWith( + isoValues: event.isoValues, + canSave: _canSave(state.name, state.lensZoom), + ), + ); } Future _onNdValuesChanged(EquipmentProfileNdValuesChangedEvent event, Emitter emit) async { _newEquipmentProfile = _newEquipmentProfile.copyWith(ndValues: event.ndValues); - emit(state.copyWith(ndValues: event.ndValues)); + emit( + state.copyWith( + ndValues: event.ndValues, + canSave: _canSave(state.name, state.lensZoom), + ), + ); } Future _onLensZoomChanged(EquipmentProfileLensZoomChangedEvent event, Emitter emit) async {