From 0730a0caf47ce5e07d6691bafce46e8a610bf70d Mon Sep 17 00:00:00 2001 From: Richard Shiue <71320345+richardshiue@users.noreply.github.com> Date: Thu, 21 Dec 2023 12:16:18 +0800 Subject: [PATCH] fix: select field type option editor overflow (#4188) --- .../widgets/header/field_editor.dart | 9 +++- .../type_option/select/select_option.dart | 44 ++++--------------- 2 files changed, 15 insertions(+), 38 deletions(-) diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/field_editor.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/field_editor.dart index 1c0ba0946c..bafd022295 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/field_editor.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/field_editor.dart @@ -331,7 +331,12 @@ class _FieldDetailsEditorState extends State { const VSpace(8.0), SwitchFieldButton(popoverMutex: popoverMutex), const TypeOptionSeparator(spacing: 8.0), - FieldTypeOptionEditor(viewId: widget.viewId, popoverMutex: popoverMutex), + Flexible( + child: FieldTypeOptionEditor( + viewId: widget.viewId, + popoverMutex: popoverMutex, + ), + ), _addFieldVisibilityToggleButton(), _addDuplicateFieldButton(), _addDeleteFieldButton(), @@ -437,7 +442,7 @@ class FieldTypeOptionEditor extends StatelessWidget { return Column( mainAxisSize: MainAxisSize.min, children: [ - typeOptionEditor, + Flexible(child: typeOptionEditor), const TypeOptionSeparator(spacing: 8.0), ], ); diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/select/select_option.dart b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/select/select_option.dart index 518c9a63f4..ad3f1e039a 100644 --- a/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/select/select_option.dart +++ b/frontend/appflowy_flutter/lib/plugins/database_view/grid/presentation/widgets/header/type_option/select/select_option.dart @@ -45,11 +45,16 @@ class SelectOptionTypeOptionWidget extends StatelessWidget { ] else const _AddOptionButton(), const VSpace(4), - _OptionList(popoverMutex: popoverMutex), + ...state.options.map((option) { + return _OptionCell( + option: option, + popoverMutex: popoverMutex, + ); + }), ]; - return Column( - mainAxisSize: MainAxisSize.min, + return ListView( + shrinkWrap: true, children: children, ); }, @@ -81,39 +86,6 @@ class _OptionTitle extends StatelessWidget { } } -class _OptionList extends StatelessWidget { - final PopoverMutex? popoverMutex; - const _OptionList({this.popoverMutex}); - - @override - Widget build(BuildContext context) { - return BlocBuilder( - buildWhen: (previous, current) { - return previous.options != current.options; - }, - builder: (context, state) { - final cells = state.options.map((option) { - return _OptionCell( - option: option, - popoverMutex: popoverMutex, - ); - }).toList(); - - return ListView.separated( - shrinkWrap: true, - separatorBuilder: (context, index) { - return VSpace(GridSize.typeOptionSeparatorHeight); - }, - itemCount: cells.length, - itemBuilder: (BuildContext context, int index) { - return cells[index]; - }, - ); - }, - ); - } -} - class _OptionCell extends StatefulWidget { final SelectOptionPB option; final PopoverMutex? popoverMutex;