搜尋套件、儲存庫與 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.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。