From 1dedb909e54d7487364ef01f2998d8ed02aa8ec4 Mon Sep 17 00:00:00 2001 From: Richard Shiue <71320345+richardshiue@users.noreply.github.com> Date: Tue, 17 Sep 2024 21:49:52 +0800 Subject: [PATCH] fix(flutter_desktop): incorrect row meta in row detail page (#6329) --- .../database/grid/presentation/grid_page.dart | 36 +++++++++++-------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart index ed783f1b69..4c3c5b438c 100755 --- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart +++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart @@ -454,11 +454,6 @@ class _GridRowsState extends State<_GridRows> { Log.warn('RowMeta is null for rowId: $rowId'); return const SizedBox.shrink(); } - final rowController = RowController( - viewId: viewId, - rowMeta: rowMeta, - rowCache: rowCache, - ); final child = GridRow( key: ValueKey(rowId), @@ -466,18 +461,31 @@ class _GridRowsState extends State<_GridRows> { rowId: rowId, viewId: viewId, index: index, - rowController: rowController, + rowController: RowController( + viewId: viewId, + rowMeta: rowMeta, + rowCache: rowCache, + ), cellBuilder: EditableCellBuilder(databaseController: databaseController), openDetailPage: (rowDetailContext) => FlowyOverlay.show( context: rowDetailContext, - builder: (_) => BlocProvider.value( - value: context.read(), - child: RowDetailPage( - rowController: rowController, - databaseController: databaseController, - userProfile: context.read().userProfile, - ), - ), + builder: (_) { + final rowMeta = rowCache.getRow(rowId)?.rowMeta; + return rowMeta == null + ? const SizedBox.shrink() + : BlocProvider.value( + value: context.read(), + child: RowDetailPage( + rowController: RowController( + viewId: viewId, + rowMeta: rowMeta, + rowCache: rowCache, + ), + databaseController: databaseController, + userProfile: context.read().userProfile, + ), + ); + }, ), );