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

GitHub 代码仓SanjaySodani/multiselect_dropdown_flutter

多选下拉框_flutter

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

多选下拉框_flutter 项目封面
星标
12
复刻
7
最近推送(UTC)
2023年12月30日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

  • 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.

Sanjay Sodani GitHub avatar
GitHub 作者

Sanjay Sodani ↗

SmartQBangalore
语言Dart

分类

此仓库发布的插件

使用的依赖

依赖清单 3 项

  • flutter{"sdk":"flutter"}
  • flutter_test开发依赖{"sdk":"flutter"}
  • flutter_lints开发依赖^2.0.0

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗