diff --git a/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart b/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart index efdde2ef..b0b8b18b 100644 --- a/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart +++ b/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_bloc.dart @@ -26,7 +26,7 @@ class DiaryEditBloc extends Bloc { on(_addPortion); //пользователь нажимает "Добавить продукт" on( _removePortion); // пользователь нажимает на крестик около продукта - on(_uploadImages); //пользователь нажимает "Добавить продукт" + on(_uploadImages); //пользователь нажимает "Добавить фото" } Future _onInitialize( @@ -97,18 +97,16 @@ class DiaryEditBloc extends Bloc { }*/ } - /*_expandWakeup( - ToggleWakeupExpandedEvent event, Emitter emit) { - emit(state.copyWith(wakeupExpanded: !state.wakeupExpanded)); - }*/ - Future _changeSatiety( ChangeSatiety event, Emitter emit) async { if (state is DiaryEditLoadedState) { var currentState = state as DiaryEditLoadedState; - emit(currentState.copyWith(selectedSatiety: event.selectedElement)); + var updatedState = + currentState.copyWith(selectedSatiety: event.selectedElement); + + emit(updatedState); // Передаем обновленное состояние в emit + currentState.selectedSatiety = event.selectedElement; - print(currentState.selectedSatiety); } } @@ -116,8 +114,11 @@ class DiaryEditBloc extends Bloc { ChangeMood event, Emitter emit) async { if (state is DiaryEditLoadedState) { var currentState = state as DiaryEditLoadedState; + var updatedState = + currentState.copyWith(selectedMood: event.selectedElement); + + emit(updatedState); // Передаем обновленное состояние в emit - emit(currentState.copyWith(selectedMood: event.selectedElement)); currentState.selectedMood = event.selectedElement; } } @@ -129,6 +130,7 @@ class DiaryEditBloc extends Bloc { emit(currentState.copyWith(moodExpanded: !currentState.moodExpanded)); currentState.moodExpanded = !currentState.moodExpanded; + print(currentState.moodExpanded); } } diff --git a/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_state.dart b/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_state.dart index 71ca214f..457a8f25 100644 --- a/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_state.dart +++ b/lib/presentation/diary/diary_edit_screen/bloc/diary_edit_state.dart @@ -46,8 +46,20 @@ class DiaryEditLoadedState extends DiaryEditState { bool wakeupExpanded; bool moodExpanded; @override - List get props => - [diaryEditModelObj, wakeupController, retireController]; + List get props => [ + diaryEditModelObj, + wakeupController, + retireController, + mealNameController, + mealTimeController, + commentController, + productNameController, + productQuantityController, + selectedMood, + selectedSatiety, + wakeupExpanded, + moodExpanded + ]; DiaryEditLoadedState copyWith({ DiaryEditModel? diaryEditModelObj, TimeOfDay? wakeupController,