From 1793a28cbc61dbbeec4efb822da5e571e6d2b7cc Mon Sep 17 00:00:00 2001 From: Richard Shiue <71320345+richardshiue@users.noreply.github.com> Date: Thu, 19 Oct 2023 18:19:50 +0800 Subject: [PATCH] fix: calendar event card not displaying as intended (#3731) --- .../application/calendar_event_editor_bloc.dart | 14 ++++++++++++-- .../presentation/calendar_event_editor.dart | 2 ++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/application/calendar_event_editor_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/application/calendar_event_editor_bloc.dart index a19450390e..ecf0aa7f05 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/application/calendar_event_editor_bloc.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/application/calendar_event_editor_bloc.dart @@ -26,7 +26,12 @@ class CalendarEventEditorBloc final cells = rowController .loadData() .values - .where((cellContext) => cellContext.isVisible()) + .where( + (cellContext) => + cellContext.isVisible() || + cellContext.fieldId == layoutSettings.fieldId || + cellContext.fieldInfo.isPrimary, + ) .toList(); if (!isClosed) { add( @@ -50,7 +55,12 @@ class CalendarEventEditorBloc onRowChanged: (cells, reason) { if (!isClosed) { final cellData = cells.values - .where((cellContext) => cellContext.isVisible()) + .where( + (cellContext) => + cellContext.isVisible() || + cellContext.fieldId == layoutSettings.fieldId || + cellContext.fieldInfo.isPrimary, + ) .toList(); add( CalendarEventEditorEvent.didReceiveCellDatas(cellData), diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_event_editor.dart b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_event_editor.dart index 0f893a13e3..1c10a7c00d 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_event_editor.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_event_editor.dart @@ -126,9 +126,11 @@ class EventPropertyList extends StatelessWidget { state.cells.firstWhereOrNull((cell) => cell.fieldInfo.isPrimary); final dateFieldIndex = reorderedList.indexWhere((cell) => cell.fieldId == dateFieldId); + if (primaryCellContext == null || dateFieldIndex == -1) { return const SizedBox.shrink(); } + reorderedList.insert(0, reorderedList.removeAt(dateFieldIndex)); final children = [