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

套件詳情v0.0.6

selectable_draggable_listbox

具備多選、列表間拖放及內建重新排序功能的清單框。

AndroidiOSmacOSWindowsLinux
近 30 天下載
19
喜歡數
26
Pub 分數
150

安裝套件

flutter pub add selectable_draggable_listbox

套件介紹

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

一個 Flutter 套件,提供內建多選支援、清單內拖曳排序,以及多個清單間拖曳的功能。它透過手勢增強使用者互動,實現直覺的資料操作。適合需要動態清單管理的應用程式,例如待辦事項整理工具、播放清單建立器或設定面板。此套件跨平台,支援 Android、iOS、macOS、Windows 與 Linux。

適用情境

  • 任務優先級
  • 播放列表管理
  • 配置面板排序
  • 表單中的資料重組
  • 多列表項轉移

主要特色

  • 多選支援
  • 列表內拖放重新排序
  • 跨清單拖放
  • 內建選擇狀態管理
  • 響應式手勢處理

適合對象

  • 開發互動式列表介面的開發者
  • 需要靈活資料重組的應用程式
  • 偏好拖曳與放置工作流程的使用者
  • 跨平台清單管理工具
  • 以UI為主的生產力應用

使用建議

  • 需要仔細處理選擇狀態
  • 複雜佈局可能需要自訂樣式
  • 大型列表帶來的效能影響
  • 僅限基於清單的資料結構
  • 依賴於正確的組件樹結構以進行拖曳目標

原始 README

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

Pub License: MIT

selectable_draggable_listbox

Listbox with multiselect, drag & drop between lists, and reorder built in.

Features

  • Bind your data to a listview of custom widget
    • Simple text item widget -or-
    • Templated list item widget for more cusomizability
  • Multi-select items
    • Shift-click to select items in sequence
    • Ctrl/Cmd-click to select individual items
    • Single-select only option available
  • Reorderable
    • Click & drag the "three lines" icon to reorder item
  • Drag & Drop
    • Drag items from/to different lists
    • Each list may independently be a draggable, drop target, or both

Feature Demo

Getting started

  1. Add the latest version of this package:
  • Run flutter pub add selectable_draggable_listbox -or-
  • Edit pubspec.yaml and then run flutter pub get:
dependencies:
  selectable_draggable_listbox: ^latest_version
  1. Import the package
import 'package:selectable_draggable_listbox/selectable_draggable_listbox.dart';

Usage

// Create your list and transform it to track selected items (list can be complex objects instead):
final myList = ['Apples','Cheese','Bread','Milk'].forListbox().toList();

// Create the listbox widget
return Listbox(
  items: myList,
  itemTemplate: (context, eventManager, index, item, onSelect) {
    // Define the template used for each listitem
    return SimpleListboxItem(
      key: Key('$index'), // Key is required for reordering
      item: item,
      label: item.data,
      eventManager: eventManager,
      onSelect: onSelect,
    );
  },
  onSelect: (itemsSelected) {
    // React to items selected
    // Note: (value of isSelected is not set automatically by Listbox,
    //  due to not knowing how your state is handled)
    setState(() {
      for (var item in myList) {
        item.isSelected = itemsSelected.contains(item);
      }
    });
  },
  onReorder: (oldIndex, newIndex) {
    // React to item reordered
    setState(() {
      // Note: this is an extension provided by the package
      myList.move(oldIndex, newIndex);
    });
  },
);

Advanced Usage

For more info on additional features like Drag & Drop and Customizable Templates, see examples and API:

Support

You can support me by buying me a coffee Buy me a coffee

And also don't forget to star this package on GitHub

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。