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

drop_down_list 封面
套件詳情v2.1.1

drop_down_list

一個可自訂的下拉選單組件,支援單選/多選,整合底部彈出式搜尋功能,對自訂資料提供通用支援,實現靈活且類型安全的處理。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
3200
喜歡數
350
Pub 分數
150

安裝套件

flutter pub add drop_down_list

套件介紹

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

一個靈活且可自訂的下拉小組件,適用於 Flutter,支援單選與多選模式。它在底部彈出視窗中整合了搜尋欄,可有效過濾選項。該套件提供泛型類型安全性,用於處理自訂資料類型,確保程式碼的穩健性與可維護性。專為跨平台使用設計,可在 Android、iOS、Web、macOS、Windows 與 Linux 上順暢運作。非常適合表單、篩選與設定,讓使用者能以增強的易用性從清單中進行選擇。

適用情境

  • 具有動態選項的表單輸入
  • 篩選大型資料集
  • 可選擇偏好的設定面板
  • 儀表板中的多選下拉選單
  • 移動和網頁應用中的可搜尋清單

主要特色

  • 支援單選與多選
  • 整合的可搜尋底端面板
  • 自定資料的泛型類型安全性
  • 跨平台相容性
  • 可自訂的樣式和行為
  • 具類型安全性之靈活資料處理

適合對象

  • 開發表單密集型應用的開發者
  • 需要可重複使用的下拉組件的團隊
  • 需要可搜尋選擇的專案
  • 針對多個平台的應用程式
  • 希望使用類型安全的下拉邏輯的使用者

使用建議

  • 需要與底部彈出面板整合以實現搜尋功能
  • 複雜的 UI 可能需要額外的樣式
  • 最適合中等至大型選項集
  • 內建驗證功能有限,僅限於選擇
  • 依賴外部相依性以實現完整自訂

原始 README

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

drop_down_list

Flutter Website Dart Website MIT License

A customizable dropdown widget supporting single/multiple selection, integrated search in a bottom sheet, generic support for flexible, type-safe handling of custom data.

Preview

Dropdown with a Multiple Selection

drop_down_with_multiple_selection

Dropdown with a Single Selection

drop_down_with_single_selection

Basic Usage

Import it to your project file

import 'package:drop_down_list/drop_down_list.dart';

And add it in its most basic form like it:

DropDownState<String>(
  dropDown: DropDown<String>(
    data: <SelectedListItem<String>>[
      SelectedListItem<String>(data: 'Tokyo'),
      SelectedListItem<String>(data: 'New York'),
      SelectedListItem<String>(data: 'London'),
    ],
    onSelected: (selectedItems) {
      List<String> list = [];
      for (var item in selectedItems) {
        list.add(item.data);
      }
      ScaffoldMessenger.of(context).showSnackBar(
        SnackBar(
          content: Text(
            list.toString(),
          ),
        ),
      );
    },
  ),
).showModal(context);

Required parameters of DropDown

Parameter Description
List<SelectedListItem<T>> data The list of generic data items to be displayed in the dropdown

Optional parameters of DropDown

Parameter Description
ItemSelectionCallBack<T>? onSelected A callback function triggered when items are selected from the list
ListItemBuilder<T>? listItemBuilder A function that takes an [index] and [dataItem] as a parameter and returns a custom widget to display for the list item at that index
int? maxSelectedItems The maximum number of items that can be selected when [enableMultipleSelection] is true
VoidCallback? onMaxSelectionReached A callback function triggered when the maximum selection limit is reached
EdgeInsets? listViewPadding The padding applied to the ListView that contains the dropdown items
Widget? listViewSeparatorWidget The widget used as a separator between items in the dropdown list
EdgeInsets? listTileContentPadding The padding applied to the content of each ListTile in the dropdown list
BottomSheetListener? bottomSheetListener A listener that monitors events bubbling up from the BottomSheet
EdgeInsets? dropDownPadding The padding applied to the dropdown container
EdgeInsets? dropDownHeaderPadding The padding applied to the dropdown header
Widget? bottomSheetTitle The widget displayed as the title of the bottom sheet
ButtonStyle? submitButtonStyle Defines a button style to display as the style of the submit button when [enableMultipleSelection] is true
ButtonStyle? clearButtonStyle Defines a button style to display as the style of the clear button when [enableMultipleSelection] is true
EdgeInsets? searchTextFieldPadding The padding applied to the search text field
TextFormField? searchWidget Defines a custom widget to display the text box for searching
EdgeInsets? selectAllTextButtonPadding The padding applied to the "select all" and "deselect all" TextButtons
Widget? selectAllTextButtonChild Defines a custom widget to display as the child of the selectAll text button when [enableMultipleSelection] and [isSelectAllVisible] is true
Widget? deSelectAllTextButtonChild Defines a custom widget to display as the child of the deSelectAll text button when [enableMultipleSelection] and [isSelectAllVisible] is true
SearchDelegate<T>? searchDelegate A delegate used to configure the custom search functionality in the dropdown

Optional parameters of DropDown with Default value

Parameter Default Description
bool enableMultipleSelection false Enables single or multiple selection for the drop down list items
Color listTileColor Colors.transparent Defines the background color of each ListTile in the dropdown list
Widget selectedListTileTrailingWidget Icon(Icons.check_box) The widget displayed as a trailing icon when a list item is selected
Widget deSelectedListTileTrailingWidget Icon(Icons.check_box_outline_blank) The widget displayed as a trailing icon when a list item is not selected
bool useRootNavigator false Specifies whether a modal bottom sheet should be displayed using the root navigator
bool enableDrag true Specifies whether the bottom sheet can be dragged up and down and dismissed by swiping downwards
bool isDismissible true Specifies whether the bottom sheet will be dismissed when the user taps on the scrim
double initialChildSize 0.7 The initial fractional value of DraggableScrollableSheet
double minChildSize 0.3 The minimum fractional value of DraggableScrollableSheet
double maxChildSize 0.9 The maximum fractional value of DraggableScrollableSheet
Color dropDownBackgroundColor Colors.transparent Sets the background color of the dropdown
String submitButtonText 'Submit' Specifies the text displayed on the submit button when [enableMultipleSelection] is true
String clearButtonText 'Clear' Specifies the text displayed on the clear button when [enableMultipleSelection] is true
bool isSearchVisible true Controls the visibility of the search widget
String searchHintText 'Search' Specifies the text displayed on the search widget as hint text
Color searchFillColor Colors.black12 This is the fill color for the input field
Color searchCursorColor Colors.black This is the cursor color for the input field
bool isSelectAllVisible true Controls the visibility of the "select all" widget when [enableMultipleSelection] is true
String selectAllButtonText 'Select All' Specifies the text displayed on the selectAll text button when [enableMultipleSelection] and [isSelectAllVisible] is true
String deSelectAllButtonText 'Deselect All' Specifies the text displayed on the deSelectAll text button when [enableMultipleSelection] and [isSelectAllVisible] is true

Required parameters of DropDownState

Parameter Description
DropDown<T> dropDown The DropDown configuration object that defines the behavior, appearance, and other properties of the dropdown menu

Optional parameters of DropDownState

Parameter Description
ShapeBorder? shapeBorder The shape of the bottom sheet

Method of DropDownState

Method Description
void showModal(BuildContext context) Displays the dropdown menu as a modal bottom sheet

Guideline for contributors

  • Contributions to our repository are always welcome! We encourage contributors to submit pull requests for development and improvements.

Guideline for Reporting an Issue or Feature Request

To help us better understand and resolve the issue, please include the following details when reporting:

  • Library version
  • Code snippet
  • Logs (if applicable)
  • Device specifications (e.g., manufacturer, OS version)
  • Screenshot or video with steps to reproduce the issue
  • Any other relevant libraries used

LICENSE!

drop_down_list is MIT-licensed.

Let us know!

We’d be really happy if you send us links to your projects where you use our open-source libraries. Just send an email to [sales@mindinventory.com](mailto:sales@mindinventory.com) And do let us know if you have any questions or suggestion regarding our work.

Visit our website mindinventory.com

Let us know if you are interested to building Apps or Designing Products.

flutter app development

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。