【问题标题】:Flutter create Dropdown Search WidgetFlutter 创建下拉搜索小部件
【发布时间】:2021-04-11 15:38:56
【问题描述】:

我正在寻找在我的一个 POC 项目中使用的 Flutter 插件。想法是创建一个带有搜索选项的下拉字段,类似于您在 Yatra(dot)com 上看到的内容。

如果有人能指导我自己创建一个小部件来实现这一点,那将非常有帮助。

非常感谢任何指导。

【问题讨论】:

    标签: flutter flutter-widget


    【解决方案1】:

    查看site 并试用此代码

    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,
                  ),
                ),
    

    【讨论】:

      猜你喜欢
      • 2017-06-30
      • 2021-10-09
      • 2020-12-06
      • 2017-12-11
      • 2018-01-27
      • 2017-11-02
      • 1970-01-01
      • 2020-06-23
      • 2012-01-20
      相关资源
      最近更新 更多