fix(app): 日历页切换月份后保留选中日期的日记列表
This commit is contained in:
@@ -131,8 +131,16 @@ class CalendarBloc extends Bloc<CalendarEvent, CalendarState> {
|
||||
|
||||
if (state is CalendarLoaded) {
|
||||
final current = state as CalendarLoaded;
|
||||
// 根据当前选中日期查找日记,避免进入页面时空白
|
||||
final dayKey = DateTime(
|
||||
current.selectedDay.year,
|
||||
current.selectedDay.month,
|
||||
current.selectedDay.day,
|
||||
);
|
||||
final selectedJournals = byDate[dayKey] ?? [];
|
||||
emit(current.copyWith(
|
||||
journalsByDate: byDate,
|
||||
selectedDayJournals: selectedJournals,
|
||||
isLoading: false,
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user