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

flutter_multiselect 封面
插件详情v1.0.2

flutter_multiselect

适用于 iOS 和 Android 的多选 UI 小部件的 Flutter 包,采用中性设计。

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

安装插件

flutter pub add flutter_multiselect

插件介绍

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

一个 Flutter 包,提供跨平台的多选 UI 小部件,兼容 iOS 和 Android,具有中性设计。它使用户能够从列表中直观地选择多个项目,适用于表单、筛选和标签界面。该小部件旨在跨平台保持一致性,包括 Web、macOS、Windows 和 Linux。在可访问性和性能方面进行了优化,可无缝集成到现有的 Flutter 应用中。

适合场景

  • 具有多个选项的表单输入
  • 仪表板中的筛选选项
  • 用于内容分类的标签选择
  • 用户偏好设置
  • 动态表单字段

主要特点

  • 跨平台兼容性
  • 中性、现代设计
  • 直观的多选手势
  • 支持所有主要的Flutter平台
  • 可通过语义标签访问
  • 可自定义的芯片样式

适合对象

  • 开发包容性、跨平台的应用程序的开发者
  • 需要灵活选择模式的应用程序
  • 设计系统优先考虑一致性
  • 使用 Flutter 进行全栈开发的团队
  • 需要轻量级、可重用组件的项目

使用建议

  • 有限的内置验证
  • 无原生键盘导航支持
  • 需要手动处理选择状态
  • 可能需要额外的样式来支持复杂主题
  • 未针对无分页的大数据集进行优化

原始 README

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

flutter_multiselect

Flutter package for multi-select UI widget

pub package

Android and iOS screenshot- screenshot

Getting Started

  • Add the package into pubspec.yaml
dependencies:
  flutter_multiselect:
  • Import in your code
import 'package:flutter_multiselect/flutter_multiselect.dart';

Why? :wrench:

By default, there is no UI control for multi-select in iOS and Android, and my widget can be used to bridge this gap.

Example without customization :one:

child: MultiSelect(
  autovalidate: false,
  titleText: "Countries",
  validator: (value) {
    if (value == null) {
      return 'Please select one or more option(s)';
    }
  },
  errorText: 'Please select one or more option(s)',
  dataSource: [
    {
      "display": "Australia",
      "value": 1,
    },
    {
      "display": "Canada",
      "value": 2,
    },
    {
      "display": "India",
      "value": 3,
    },
    {
      "display": "United States",
      "value": 4,
    }
  ],
  textField: 'display',
  valueField: 'value',
  filterable: true,
  required: true,
  value: null,
  onSaved: (value) {
    print('The saved values are $value');
  }
),

Example with customization :two:

Check the colors and text to see the changes that it makes to the modal interface

child: MultiSelect(
    //--------customization selection modal-----------
    buttonBarColor: Colors.red,
    cancelButtonText: "Exit",
    titleText: "Custom Title",
    checkBoxColor: Colors.black,
    selectedOptionsInfoText: "Selected custom text (tap to remove)",
    selectedOptionsBoxColor: Colors.green,
    autovalidate: true,
    maxLength: 5, // optional
    //--------end customization selection modal------------
    validator: (dynamic value) {
      if (value == null) {
        return 'Please select one or more option(s)';
      }
      return null;
    },
    errorText: 'Please select one or more option(s)',
    dataSource: [
      {"name": "Afghanistan", "code": "AF"},
      {"name": "Åland Islands", "code": "AX"},
      {"name": "Albania", "code": "AL"},
    ],
    textField: 'name',
    valueField: 'code',
    filterable: true,
    required: true,
    onSaved: (value) {
      print('The saved values are $value');
    }),
    change: (value) {
      print('The selected values are $value');
    })

and of course you can check the full list of the parameters to personalize your modal!

Here, the complete list of parameters to modify the selection modal :clipboard:

Type Parameter
Color buttonBarColor
String cancelButtonText
IconData cancelButtonIcon
Color cancelButtonColor
Color cancelButtonTextColor
String saveButtonText
IconData saveButtonIcon
Color saveButtonColor
Color saveButtonTextColor
String clearButtonText
IconData clearButtonIcon
Color clearButtonColor
Color clearButtonTextColor
String deleteButtonTooltipText
IconData deleteIcon
Color deleteIconColor
Color selectedOptionsBoxColor
String selectedOptionsInfoText
Color selectedOptionsInfoTextColor
IconData checkedIcon
IconData uncheckedIcon
Color checkBoxColor
Color searchBoxColor
String searchBoxHintText
Color searchBoxFillColor
IconData searchBoxIcon
String searchBoxToolTipText
Size responsiveDialogSize

所属分类

源码仓库

使用此插件的项目

暂无相关数据。