forked from eatvio/eatvio_app
feat(diary): added state for future days with diet
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user