我有以下组件,它利用建议(使用
Autocomplete
类):
return Autocomplete<String>(
// ...
fieldViewBuilder: (BuildContext context,
TextEditingController fieldTextEditingController,
FocusNode focusNode,
VoidCallback onFieldSubmitted) {
return TextField(
// ...
);
optionsViewBuilder: (BuildContext context,
AutocompleteOnSelected<String> onSelected,
Iterable<String> options) {
return Material(
elevation: 4.0,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: white,
),
width: 360.0,
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount: options.length,
// ...
)
我的目标是以某种方式让选项显示在输入字段的正上方,而不是下方,因为该组件放置在页面的底部
optionsViewOpenDirection: OptionsViewOpenDirection.up,