[英]Flutter create Dropdown Search Widget
I am looking for a Flutter Plugin to use in one of my POC projects.我正在寻找一个 Flutter 插件用于我的一个 POC 项目。 Idea is to create a dropdown field with a search option, something similar to what you can see on Yatra(dot)com.想法是创建一个带有搜索选项的下拉字段,类似于您在 Yatra(dot)com 上看到的内容。
It will be really helpful if someone can guide me to create a widget by myself to achieve this.如果有人可以指导我自己创建一个小部件来实现这一点,那将非常有帮助。
Any guidance is highly appreciated.非常感谢任何指导。
Have a look in this site and try out this code查看此站点并尝试此代码
Container(
child: DropdownSearch<String>(
mode: Mode.DIALOG,
showSearchBox: true,
searchBoxDecoration: InputDecoration(
filled: true,
fillColor: Colors.grey,
),
showAsSuffixIcons: true,
showClearButton: false,
dropdownButtonBuilder: (_) => Padding(
padding: const EdgeInsets.all(8.0),
child: const Icon(
Icons.arrow_drop_down,
size: 24,
color: Colors.red,
),
),
showSelectedItem: true,
items: ["bs", "test", "company"],
onChanged: (String newValue) {
setState(() {
// dropDownValue = newValue;
});
},
// selectedItem: dropDownValue,
),
),
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.