feat(diary): added state for future days with diet

This commit is contained in:
Username1548
2025-05-26 21:37:06 +07:00
parent 2d836002b7
commit b4dd9b3a3a
84 changed files with 247 additions and 7 deletions

View File

@@ -53,8 +53,30 @@ class _CalendarWidgetState extends State<CalendarWidget> {
if (!isSameDay(_selectedDay, selectedDay)) {
final today = DateTime.now();
if (selectedDay.isAfter(today)) {
showErrorDialog(context, title: s.want_to_see_tomorrow, description: s.can_not_see_next_day);
return;
if ((state is DiaryStateLoaded)) {
if (!state.diary.typeOfDiary.hasChosenDiet) {
showErrorDialog(context, title: s.want_to_see_tomorrow, description: s.can_not_see_next_day);
return;
}
setState(() {
_selectedDay = selectedDay;
_focusedDay = focusedDay;
});
context.read<DiaryCubit>().setSelectedDay(_selectedDay, forDietOnly: true);
return;
}
if (state is DiaryStateLoadedTomorrowWithDiet) {
if (!state.diary.typeOfDiary.hasChosenDiet) {
showErrorDialog(context, title: s.want_to_see_tomorrow, description: s.can_not_see_next_day);
return;
}
setState(() {
_selectedDay = selectedDay;
_focusedDay = focusedDay;
});
context.read<DiaryCubit>().setSelectedDay(_selectedDay, forDietOnly: true);
return;
}
}
setState(() {
_selectedDay = selectedDay;