forked from eatvio/eatvio_app
fix(diary): UI errors fix
This commit is contained in:
@@ -58,11 +58,19 @@ class DiaryBloc extends Bloc<DiaryEvent, DiaryState> {
|
||||
final int? diaryID = data['id'];
|
||||
final DiaryModel diary = await diaryRepository.getDiary(diaryID ?? 45);
|
||||
final Meal currentMeal = diary.meals[0];
|
||||
List<SelectionPopupModel> portions = [
|
||||
SelectionPopupModel(title: "gr"),
|
||||
SelectionPopupModel(title: "pcs")
|
||||
];
|
||||
emit(DiaryState.loaded(
|
||||
diary: diary,
|
||||
currentMeal: currentMeal,
|
||||
portions: currentMeal.portions,
|
||||
photos: currentMeal.photos,
|
||||
portionList: portions,
|
||||
portionController: portions[0],
|
||||
selectedMood: 3,
|
||||
selectedSatiety: 3,
|
||||
commentController: TextEditingController(),
|
||||
productNameController: TextEditingController(),
|
||||
productQuantityController: TextEditingController(),
|
||||
@@ -159,7 +167,8 @@ class DiaryBloc extends Bloc<DiaryEvent, DiaryState> {
|
||||
'Satiety change success! meal_id: ${currentState.currentMeal.id}, mood: ${event.selectedElement}',
|
||||
);
|
||||
emit(updatedState); // Передаем обновленное состояние в emit
|
||||
}
|
||||
} else
|
||||
print("dad");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,9 +444,9 @@ class DiaryBloc extends Bloc<DiaryEvent, DiaryState> {
|
||||
var currentState = state as DiaryStateLoaded;
|
||||
|
||||
var response = await sendPortionData(
|
||||
currentState.productNameController?.text,
|
||||
currentState.portionController?.id == 0 ? 'pcs' : 'gr',
|
||||
int.parse(currentState.productQuantityController!.text),
|
||||
currentState.productNameController.text,
|
||||
currentState.portionController.id == 0 ? 'pcs' : 'gr',
|
||||
int.parse(currentState.productQuantityController.text),
|
||||
currentState.currentMeal.id,
|
||||
currentState.diary.id,
|
||||
);
|
||||
@@ -623,7 +632,7 @@ class DiaryBloc extends Bloc<DiaryEvent, DiaryState> {
|
||||
currentState.diary.id,
|
||||
currentState.wakeupController,
|
||||
currentState.retireController,
|
||||
currentState.commentController?.text,
|
||||
currentState.commentController.text,
|
||||
);
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
|
||||
Reference in New Issue
Block a user