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

插件详情v0.0.7

multiselect_dropdown_flutter

一个简单的多选下拉框,支持全选和搜索功能。可与简单列表和映射列表一起使用。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
2570
喜欢数
30
Pub 分数
150

安装插件

flutter pub add multiselect_dropdown_flutter

插件介绍

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

一个 Flutter 包,提供可自定义的多选下拉菜单,支持搜索和“全选”功能。它支持简单列表和映射列表,便于集成到表单或筛选器中。该下拉菜单在所有主要平台(包括 Android、iOS、Web、macOS、Windows 和 Linux)上均兼容。非常适合需要从大型数据集中高效选择多个项目的应用程序。

适合场景

  • 具有多个选项的表单输入
  • 使用多个条件过滤数据
  • 用户偏好选择
  • 仪表板中的动态列表选择
  • 增强数据录入表单的用户体验

主要特点

  • 可搜索下拉框
  • 全选选项
  • 支持简单的列表和映射
  • 跨平台兼容性
  • 可自定义的 UI
  • 与 Flutter 的轻松集成

适合对象

  • 使用多个选择构建表单的开发人员
  • 需要过滤界面的应用程序
  • 需要轻量级下拉组件的项目
  • 使用 Flutter 开发多平台应用的团队
  • 希望为多选功能实现最小化设置的用户

使用建议

  • 可能需要自定义样式以实现复杂设计
  • 有限的内置验证
  • 在非常大的数据集上,性能可能会下降
  • 空选择项无内置错误处理
  • 依赖外部状态管理来更新值

原始 README

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

  • A simple multiselect dropdown which has Select All and Search options.
  • You can use a simple list or a list of maps.

Features

MultiSelect Dropdown demo

  • Use MultiSelectDropdown for list of maps.
  • Use MultiSelectDropdown.simpleList for a simple list.

Getting started

  • Add the package in your flutter project.
  • Import the package import 'package:multiselect_dropdown_flutter/multiselect_dropdown_flutter.dart';.

Usage

class MultiSelectExample extends StatelessWidget {
  const MultiSelectExample({super.key});

  final List myList2 = const ['Dog', 'Cat', 'Mouse', 'Rabbit'];

  final List myList = const [
    {'id': 'dog', 'label': 'Dog'},
    {'id': 'cat', 'label': 'Cat'},
    {'id': 'mouse', 'label': 'Mouse'},
    {'id': 'rabbit', 'label': 'Rabbit'},
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          MultiSelectDropdown(
            list: myList,
            initiallySelected: const [],
            onChange: (newList) {
              // your logic
            },
          ),
          const SizedBox(height: 50),
          MultiSelectDropdown.simpleList(
            list: myList2,
            initiallySelected: const [],
            onChange: (newList) {
              // your logic
            },
            includeSearch: true,
            includeSelectAll: true,
          ),
        ],
      ),
    );
  }
}

Parameters

Parameter Name Description
list List of options to select from
label label key in a Map to show as an option. Defaults to 'label'
id id key in a Map to identify an item. Defaults to 'id'
onChange onChange callback, passes new list as argument
numberOfItemsLabelToShow Number of items to show as text, beyond that it will show n selected
initiallySelected Initially selected list
boxDecoration Decoration for anchor element
isLarge Dropdown size
width Anchor and modal width
whenEmpty Text to show when nothing is selected
includeSelectAll Includes a select all button when true
includeSearch Includes a search option when true
textStyle TextStyle? for the text on anchor element
duration Duration? for debounce in search option. Defaults to 300 milliseconds.
checkboxFillColor checkbox fill color
splashColor splash color on list tile
listTextStyle text style for text on list tile


 

I will keep adding more functionalities.
You can raise an issue/feature request on github.
Please leave a like if you find this package useful.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。