搜尋套件、儲存庫與 APP 分類

dropdown_plus_plus 封面
套件詳情v0.1.1+1

dropdown_plus_plus

簡單易用的表單下拉選單,支援搜尋、鍵盤導航、離線資料來源、遠端資料來源及輕鬆自訂。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
14
喜歡數
11
Pub 分數
140

安裝套件

flutter pub add dropdown_plus_plus

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

DropdownPlusPlus 是一個多功能且易用的 Flutter 下拉選單元件,專為表單中順暢整合而設計。支援搜尋功能、鍵盤導航,以及離線與遠端資料來源。此套件提供廣泛的自訂選項,非常適合跨多個平台的動態與響應式表單輸入。以簡潔的 API 和最少設定,提升使用者體驗,同時維持開發者的彈性。

適用情境

  • 帶可搜尋下拉列表的表單輸入
  • 從API動態加載數據
  • 表單中的離線數據選擇
  • 鍵盤可導航的下拉選單
  • 可自定義的下拉項目 UI
  • 跨平台表單組件

主要特色

  • 支援即時過濾的可搜尋下拉選單
  • 支援遠端與本機資料來源
  • 鍵盤導航(方向鍵、Enter 鍵)
  • 高度可自訂的外觀與行為
  • 內建的載入與錯誤狀態
  • 跨所有平台的響應式設計

適合對象

  • 開發複雜表單的開發者
  • 需要可搜尋下拉選單的應用程式
  • 需要遠端或離線資料的專案
  • 重視跨平台一致性的團隊
  • 需要靈活下拉選單的UI密集型應用
  • 使用可重複使用的表單元件進行快速原型設計

使用建議

  • 需要謹慎處理非同步資料載入
  • 可能需要額外的樣式來支援複雜主題
  • 使用極大資料集時的效能影響
  • 除了基本用法之外,文件內容有限
  • 可能需要自定義滾動行為
  • 依賴外部狀態管理以實現動態更新

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

dropdown_plus_plus

Simple and easy to use Dropdown in forms with search, keyboard navigation, offiline data source, remote data source and easy customization.

A maintained fork of dropdown_plus with a lot more customisations.

Getting Started

Simple Text Dropdown.

TextDropdownFormField(
  options: ["Male", "Female"],
  decoration: InputDecoration(
      border: OutlineInputBorder(),
      suffixIcon: Icon(Icons.arrow_drop_down),
      labelText: "Gender"),
  cursorColor: Colors.green,
  dropdownItemColor: Colors.red,
),

Install

packages.yaml
dropdown_plus_plus: <lastest version>

Customizable Example


 final List<Map<String, dynamic>> _roles = [
    {"name": "Super Admin", "desc": "Having full access rights", "role": 1},
    {
      "name": "Admin",
      "desc": "Having full access rights of a Organization",
      "role": 2
    },
    {
      "name": "Manager",
      "desc": "Having Magenent access rights of a Organization",
      "role": 3
    },
    {
      "name": "Technician",
      "desc": "Having Technician Support access rights",
      "role": 4
    },
    {
      "name": "Customer Support",
      "desc": "Having Customer Support access rights",
      "role": 5
    },
    {"name": "User", "desc": "Having End User access rights", "role": 6},
  ];


// ...
// ...

DropdownFormField<Map<String, dynamic>>(
    onEmptyActionPressed: () async {},
    dropdownItemSeparator: Divider(
      color: Colors.black,
      height: 1,
      ),
    decoration: InputDecoration(
        border: OutlineInputBorder(),
        suffixIcon: Icon(Icons.arrow_drop_down),
        labelText: "Access"),
    onSaved: (dynamic str) {},
    onChanged: (dynamic str) {},
    validator: (dynamic str) {},
    displayItemFn: (dynamic item) => Text(
    item['name'] ?? '',
    style: TextStyle(fontSize: 16),
    ),
    findFn: (dynamic str) async => _roles,
    filterFn: (dynamic item, str) =>
        item['name'].toLowerCase().indexOf(str.toLowerCase()) >= 0,
    dropdownItemFn: (dynamic item, position, focused,
            dynamic lastSelectedItem, onTap) =>
        ListTile(
    title: Text(item['name']),
    subtitle: Text(
        item['desc'] ?? '',
    ),
    tileColor:
        focused ? Color.fromARGB(20, 0, 0, 0) : Colors.transparent,
    onTap: onTap,
    ),
),

Options

final bool autoFocus;
final bool Function(dynamic item, String str)? filterFn;
final bool Function(dynamic item1, dynamic item2)? selectedFn;
final Future<List<dynamic>> Function(String str) findFn;

final ListTile Function(
  dynamic item,
  int position,
  bool focused,
  bool selected,
  Function() onTap,
) dropdownItemFn;

final Widget Function(dynamic item) displayItemFn;
final InputDecoration? decoration;
final Color? dropdownColor;
final Color? cursorColor;
final DropdownEditingController<T>? controller;
final void Function(dynamic item)? onChanged;
final void Function(dynamic)? onSaved;
final String? Function(T?)? validator;
final double? dropdownHeight;
final TextStyle? searchTextStyle;
final String emptyText;
final String emptyActionText;
final Future<void> Function(String)? onEmptyActionPressed;
final Widget? dropdownItemSeparator;

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。