From dbbdc13d969c31c6e4a80e9f70dd2939b7b24858 Mon Sep 17 00:00:00 2001 From: Richard Shiue <71320345+richardshiue@users.noreply.github.com> Date: Wed, 8 May 2024 22:05:50 +0800 Subject: [PATCH] fix: database row page breadcrumbs on smaller screens (#5289) --- .../presentation/database_document_title.dart | 54 ++++++++----------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/frontend/appflowy_flutter/lib/plugins/database_document/presentation/database_document_title.dart b/frontend/appflowy_flutter/lib/plugins/database_document/presentation/database_document_title.dart index 47cf99b293..37905ac88b 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_document/presentation/database_document_title.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_document/presentation/database_document_title.dart @@ -54,12 +54,7 @@ class ViewTitleBarWithRow extends StatelessWidget { return Visibility( visible: maxWidth < constraints.maxWidth, // if the width is too small, only show one view title bar without the ancestors - replacement: _ViewTitle( - key: ValueKey(state.ancestors.last), - view: state.ancestors.last, - maxTitleWidth: constraints.maxWidth - 50.0, - onUpdated: () {}, - ), + replacement: _buildRowName(), child: Row( // refresh the view title bar when the ancestors changed key: ValueKey(state.ancestors.hashCode), @@ -104,42 +99,39 @@ class ViewTitleBarWithRow extends StatelessWidget { } Widget _buildRowName() { - return BlocBuilder( - builder: (context, state) { - if (state.databaseController == null) { - return const SizedBox.shrink(); - } - return _RowName( - cellBuilder: EditableCellBuilder( - databaseController: state.databaseController!, - ), - primaryFieldId: state.fieldId!, - rowId: rowId, - ); - }, + return _RowName( + rowId: rowId, ); } } class _RowName extends StatelessWidget { const _RowName({ - required this.cellBuilder, - required this.primaryFieldId, required this.rowId, }); - final EditableCellBuilder cellBuilder; - final String primaryFieldId; final String rowId; @override Widget build(BuildContext context) { - return cellBuilder.buildCustom( - CellContext( - fieldId: primaryFieldId, - rowId: rowId, - ), - skinMap: EditableCellSkinMap(textSkin: _TitleSkin()), + return BlocBuilder( + builder: (context, state) { + if (state.databaseController == null) { + return const SizedBox.shrink(); + } + + final cellBuilder = EditableCellBuilder( + databaseController: state.databaseController!, + ); + + return cellBuilder.buildCustom( + CellContext( + fieldId: state.fieldId!, + rowId: rowId, + ), + skinMap: EditableCellSkinMap(textSkin: _TitleSkin()), + ); + }, ); } } @@ -220,12 +212,10 @@ enum _ViewTitleBehavior { class _ViewTitle extends StatefulWidget { const _ViewTitle({ - super.key, required this.view, this.behavior = _ViewTitleBehavior.editable, - this.maxTitleWidth = 180, required this.onUpdated, - }); + }) : maxTitleWidth = 180; final ViewPB view; final _ViewTitleBehavior behavior;