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

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。