fix: select field type option editor overflow (#4188)

This commit is contained in:
Richard Shiue 2023-12-21 12:16:18 +08:00 committed by GitHub
parent 13260e1db8
commit 0730a0caf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 38 deletions

View File

@ -331,7 +331,12 @@ class _FieldDetailsEditorState extends State<FieldDetailsEditor> {
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),
],
);

View File

@ -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<SelectOptionTypeOptionBloc, SelectOptionTypeOptionState>(
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;