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

套件詳情v1.0.0+2

dynamic_treeview

一個可透過動態父/子關係建立的動態樹狀檢視。支援無限層級的分類/子分類清單,並支援水平與垂直捲動。

近 30 天下載
7
喜歡數
47
Pub 分數
40

安裝套件

flutter pub add dynamic_treeview

套件介紹

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

一個用於建立動態、互動式樹狀檢視的 Flutter 套件,支援彈性的父-子關係。它能建構無限層級的分類與子分類層次結構,支援水平與垂直捲動以處理大量資料。非常適合組織巢狀資料結構,例如檔案系統、組織圖表或產品分類。樹狀結構會動態適應資料變更,確保順暢的效能與可擴展性。

適用情境

  • 組織架構圖
  • 檔案系統導航
  • 產品分類樹
  • 嵌套資料展示
  • 動態篩選介面

主要特色

  • 支援無限嵌套層級
  • 水平和垂直滾動支援
  • 動態資料繫結
  • 可自訂節點樣式
  • 高效渲染大型數據集

適合對象

  • 具有層級資料的應用程式
  • 需要可展開列表的複雜UI
  • 資料密集型應用
  • 自訂樹狀導航
  • 可擴展的 UI 元件

使用建議

  • 需要仔細的狀態管理
  • 過深的樹狀結構可能導致效能下降
  • 有限的平台特定優化
  • 無內建的搜尋/篩選功能
  • 需要自訂動畫實作

原始 README

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

dynamic_treeview - A flutter package

A Dynamic treeview that can be build using dynamic parent/child relationship. It supports indefinite category/subcategory lists with horizontal and vertical scrolling

Getting Started

In your flutter project add the dependency:

    dependencies:
        ...
        dynamic_treeview: 1.0.0+2

Import package

import 'package:dynamic_treeview/dynamic_treeview.dart';

BaseModel implementation

    Since DynamicTreeView is build using data having parent/child relationship, 
    you must create a class model that implements BaseModel and overrides the method 
    like getParentId(), getId() and getTitle() and return appropriate values to make it work. 
    The method getExtraData() has also been added just in-case if any extra data is needed when child/parent is tapped.

Sample Usage

    DynamicTreeView(
        data: getData(), // pass here List<BaseModel>
        config: Config(
            parentTextStyle:
                TextStyle(color: Colors.black, fontWeight: FontWeight.w600),
            rootId: "1",
            parentPaddingEdgeInsets:
                EdgeInsets.only(left: 16, top: 0, bottom: 0)),
        onTap: (m) {
        //action on tap
        },
        width: MediaQuery.of(context).size.width,
    )

Constructor parameters

    data                -   List<BaseData> .TreeView will be build based on this data.This is a required field
    config              -   Various Configuration options
    onTap               -   Callback when tapped on parent/child widget

Configuration parameters

    parentTextStyle                 -   Parent tile TextStyle
    parentPaddingEdgeInsets         -   Parent tile padding
    childrenTextStyle               -   Child tile TextStyle
    childrenPaddingEdgeInsets       -   Children tile padding

Check the Config class in dynamic_treeview.dart file for details.

Sample code

Please check example for details.

Screenshots

Full Screen

alt text

Drawer

alt text

MIT LICENSE
I spent weeks of my time developing this package. I really hope this saves you loads of time and i'd be glad to hear your feedback.Let me know if you find any bugs/issues.Thanks.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。