搜索插件、代码仓与 APP 分类

dropdown_plus_plus 封面
插件详情v0.1.1+1

dropdown_plus_plus

简单易用的下拉框,支持搜索、键盘导航、离线数据源、远程数据源以及轻松自定义。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
14
喜欢数
11
Pub 分数
140

安装插件

flutter pub add dropdown_plus_plus

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

DropdownPlusPlus 是一个功能强大且用户友好的 Flutter 下拉菜单小部件,专为表单中的无缝集成而设计。它支持搜索功能、键盘导航以及离线和远程数据源。该包提供了广泛的自定义选项,使其成为跨多个平台的动态和响应式表单输入的理想选择。凭借简洁的 API 和最少的设置,它在保持开发人员灵活性的同时提升了用户体验。

适合场景

  • 带可搜索下拉列表的表单输入
  • 从API动态加载数据
  • 表单中的离线数据选择
  • 键盘可导航的下拉菜单
  • 可自定义的下拉项 UI
  • 跨平台表单组件

主要特点

  • 支持实时过滤的可搜索下拉菜单
  • 对远程和本地数据源的支持
  • 键盘导航(方向键、回车键)
  • 高度可定制的外观和行为
  • 内置的加载和错误状态
  • 跨所有平台的响应式设计

适合对象

  • 开发复杂表单的开发者
  • 需要可搜索下拉列表的应用程序
  • 需要远程或离线数据的项目
  • 注重跨平台一致性的团队
  • 需要灵活下拉菜单的UI密集型应用
  • 使用可重用的表单组件进行快速原型设计

使用建议

  • 需要谨慎处理异步数据加载
  • 可能需要额外的样式来支持复杂主题
  • 使用超大数据集时的性能影响
  • 除了基本用法外,文档有限
  • 可能需要自定义滚动行为
  • 依赖外部状态管理以实现动态更新

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

dropdown_plus_plus

Simple and easy to use Dropdown in forms with search, keyboard navigation, offiline data source, remote data source and easy customization.

A maintained fork of dropdown_plus with a lot more customisations.

Getting Started

Simple Text Dropdown.

TextDropdownFormField(
  options: ["Male", "Female"],
  decoration: InputDecoration(
      border: OutlineInputBorder(),
      suffixIcon: Icon(Icons.arrow_drop_down),
      labelText: "Gender"),
  cursorColor: Colors.green,
  dropdownItemColor: Colors.red,
),

Install

packages.yaml
dropdown_plus_plus: <lastest version>

Customizable Example


 final List<Map<String, dynamic>> _roles = [
    {"name": "Super Admin", "desc": "Having full access rights", "role": 1},
    {
      "name": "Admin",
      "desc": "Having full access rights of a Organization",
      "role": 2
    },
    {
      "name": "Manager",
      "desc": "Having Magenent access rights of a Organization",
      "role": 3
    },
    {
      "name": "Technician",
      "desc": "Having Technician Support access rights",
      "role": 4
    },
    {
      "name": "Customer Support",
      "desc": "Having Customer Support access rights",
      "role": 5
    },
    {"name": "User", "desc": "Having End User access rights", "role": 6},
  ];


// ...
// ...

DropdownFormField<Map<String, dynamic>>(
    onEmptyActionPressed: () async {},
    dropdownItemSeparator: Divider(
      color: Colors.black,
      height: 1,
      ),
    decoration: InputDecoration(
        border: OutlineInputBorder(),
        suffixIcon: Icon(Icons.arrow_drop_down),
        labelText: "Access"),
    onSaved: (dynamic str) {},
    onChanged: (dynamic str) {},
    validator: (dynamic str) {},
    displayItemFn: (dynamic item) => Text(
    item['name'] ?? '',
    style: TextStyle(fontSize: 16),
    ),
    findFn: (dynamic str) async => _roles,
    filterFn: (dynamic item, str) =>
        item['name'].toLowerCase().indexOf(str.toLowerCase()) >= 0,
    dropdownItemFn: (dynamic item, position, focused,
            dynamic lastSelectedItem, onTap) =>
        ListTile(
    title: Text(item['name']),
    subtitle: Text(
        item['desc'] ?? '',
    ),
    tileColor:
        focused ? Color.fromARGB(20, 0, 0, 0) : Colors.transparent,
    onTap: onTap,
    ),
),

Options

final bool autoFocus;
final bool Function(dynamic item, String str)? filterFn;
final bool Function(dynamic item1, dynamic item2)? selectedFn;
final Future<List<dynamic>> Function(String str) findFn;

final ListTile Function(
  dynamic item,
  int position,
  bool focused,
  bool selected,
  Function() onTap,
) dropdownItemFn;

final Widget Function(dynamic item) displayItemFn;
final InputDecoration? decoration;
final Color? dropdownColor;
final Color? cursorColor;
final DropdownEditingController<T>? controller;
final void Function(dynamic item)? onChanged;
final void Function(dynamic)? onSaved;
final String? Function(T?)? validator;
final double? dropdownHeight;
final TextStyle? searchTextStyle;
final String emptyText;
final String emptyActionText;
final Future<void> Function(String)? onEmptyActionPressed;
final Widget? dropdownItemSeparator;

所属分类

源码仓库

使用此插件的项目

暂无相关数据。