All Projects → xrr2016 → flutter-tree

xrr2016 / flutter-tree

Licence: MIT license
Flutter tree widget

Programming Languages

javascript
184084 projects - #8 most used programming language
dart
5743 projects
C++
36643 projects - #6 most used programming language
CMake
9771 projects
HTML
75241 projects
swift
15916 projects

Projects that are alternatives of or similar to flutter-tree

cryptocoins-desklet-cinnamon
Cryptocurrency Ticker (Desklet) for Cinnamon Desktop that displays the current price for thousands of cryptocurrencies, and their daily percent changes.
Stars: ✭ 18 (-60.87%)
Mutual labels:  widget
titik
A cross platform minimalistic text user interface
Stars: ✭ 112 (+143.48%)
Mutual labels:  widget
floppy
🧩 Handling and maintain your UI view component easily
Stars: ✭ 55 (+19.57%)
Mutual labels:  widget
MiniMusicView
A simple custom music play widget
Stars: ✭ 31 (-32.61%)
Mutual labels:  widget
LiquidEqualizerWidget
Modern 15-band equalizer for C++/Qt
Stars: ✭ 26 (-43.48%)
Mutual labels:  widget
SwiftListView
Instagram style - Collection of simple & neutral list views for Swift
Stars: ✭ 17 (-63.04%)
Mutual labels:  widget
kde-plasmoid-betterinlineclock
Your usual clock widget, just way better and on a single line!
Stars: ✭ 18 (-60.87%)
Mutual labels:  widget
measurer
A widget that measure the size of its child.
Stars: ✭ 40 (-13.04%)
Mutual labels:  widget
flutter calendar view
A Flutter package allows you to easily implement all calendar UI and calendar event functionality. 👌🔝🎉
Stars: ✭ 219 (+376.09%)
Mutual labels:  widget
js-fileexplorer
A zero dependencies, customizable, pure Javascript widget for navigating, managing, uploading, and downloading files and folders or other hierarchical object structures on any modern web browser.
Stars: ✭ 124 (+169.57%)
Mutual labels:  widget
flutter trianglify
Flutter library to generate beautiful triangle art views for android and ios.
Stars: ✭ 31 (-32.61%)
Mutual labels:  widget
Covid-19 Ampel
Covid-19_Ampel | Zeigt neben der 7-Tage-Inzidenz weitere Infos zu einer Region.
Stars: ✭ 33 (-28.26%)
Mutual labels:  widget
fullcalendar-calendar
Web Component wrapper for FullCalendar
Stars: ✭ 21 (-54.35%)
Mutual labels:  widget
SvgViewerWidgetTWX
Thingworx widget for runtime display and manipulation of a SVG
Stars: ✭ 13 (-71.74%)
Mutual labels:  widget
infinite-carousel-flutter
Carousel in flutter. Supports infinite looping and gives control over anchor and velocity.
Stars: ✭ 24 (-47.83%)
Mutual labels:  widget
nl.fokkezb.form
[UNMAINTAINED] Alloy TableView Form Widget
Stars: ✭ 43 (-6.52%)
Mutual labels:  widget
Graphics32 RBC
Graphics Extension that extend of Graphics32 Library for Delphi XE6 and up (and maybe Lazarus) by Uğur PARLAYAN
Stars: ✭ 32 (-30.43%)
Mutual labels:  widget
yii2-switch-widget
Bootstrap Switch Widget for Yii2
Stars: ✭ 17 (-63.04%)
Mutual labels:  widget
awesome-power widget
A Power widget for the Awesome Window Manager
Stars: ✭ 25 (-45.65%)
Mutual labels:  widget
develop
A simple tool to help elementary OS developers to develop their own apps and widgets.
Stars: ✭ 38 (-17.39%)
Mutual labels:  widget

Flutter Tree

cover

GitHub stars pub package Run Test

Version1

Online Example

Install

dependencies:
  flutter_tree: ^2.0.0

Uasge

First Step

/// Your server data
final serverData = [
  {
    "checked": true,
    "children": [
      {
        "checked": true,
        "show": false,
        "children": [],
        "id": 11,
        "pid": 1,
        "text": "Child title 11",
      },
    ],
    "id": 1,
    "pid": 0,
    "show": false,
    "text": "Parent title 1",
  },
  {
    "checked": true,
    "show": false,
    "children": [],
    "id": 2,
    "pid": 0,
    "text": "Parent title 2",
  },
  {
    "checked": true,
    "children": [],
    "id": 3,
    "pid": 0,
    "show": false,
    "text": "Parent title 3",
  },
];

/// Map server data to tree node data
TreeNodeData mapServerDataToTreeData(Map data) {
  return TreeNodeData(
    extra: data,
    title: data['text'],
    expaned: data['show'],
    checked: data['checked'],
    children:
        List.from(data['children'].map((x) => mapServerDataToTreeData(x))),
  );
}

/// Generate tree data
List<TreeNodeData> treeData = List.generate(
  serverData.length,
  (index) => mapServerDataToTreeData(serverData[index]),
);

Basic

TreeView(data: treeData)

basic

Show Filter

TreeView(
  data: treeData,
  showFilter: true,
),

filter

Checked

TreeView(
  data: treeData,
  showCheckBox: true,
),

checked

Show Actions

/// Make sure pass `append` function.

TreeView(
  data: treeData,
  showActions: true,
  showCheckBox: true,
  append: (parent) {
    print(parent.extra);
    return TreeNodeData(
      title: 'Appended',
      expaned: true,
      checked: true,
      children: [],
    );
  },
),

actions

Bind Events

TreeView(
  data: treeData,
  showActions: true,
  showCheckBox: true,
  append: (parent) {
    return TreeNodeData(
      title: 'Appended',
      expaned: true,
      checked: true,
      children: [],
    );
  },
  onTap: (node) {
    print(node.extra);
  },
  onCheck: (checked, node) {
    print(checked);
    print(node.extra);
  },
  onCollapse: (node) {
    print(node.extra);
  },
  onExpand: (node) {
    print(node.extra);
  },
  onAppend: (node, parent) {
    print(node.extra);
    print(parent.extra);
  },
  onRemove: (node, parent) {
    print(node.extra);
    print(parent.extra);
  },
),

Lazy load

/// Create your load function, return list of TreeNodeData

Future<List<TreeNodeData>> _load(TreeNodeData parent) async {
  await Future.delayed(const Duration(seconds: 1));
  final data = [
    TreeNodeData(
      title: 'load1',
      expaned: false,
      checked: true,
      children: [],
      extra: null,
    ),
    TreeNodeData(
      title: 'load2',
      expaned: false,
      checked: false,
      children: [],
      extra: null,
    ),
  ];

  return data;
}

TreeView(
  data: treeData,
  lazy: true,
  load: _load,
  onLoad: (node) {
    print('onLoad');
    print(node.extra);
  },
),

load

All Props

property type default description required
data List<TreeNodeData> [] Tree data true
lazy bool false Lazy load node data false
icon Widget Icons.expand_more Tree icon false
offsetLeft double 24.0 Item padding left false
showFilter bool false Show tree filter false
showActions bool false Show node actions false
showCheckBox bool false Show node checkbox false
onTap Function(TreeNodeData) null Node tap callback false
onExpand Function(TreeNodeData) null Node expaned callback false
onLoad Function(TreeNodeData) null Node lazy load callback false
onCollapse Function(TreeNodeData) null Node collapse callback false
onCheck Function(bool, TreeNodeData) null Node check callback false
onAppend Function(TreeNodeData, TreeNodeData) null Node append callback false
onRemove Function(TreeNodeData, TreeNodeData) null Node remove callback false
append Function(TreeNodeData) null Append node data function false
load Future<List<TreeNodeData>> Function(TreeNodeData) null Load node data function false

TODO

  • Draggable tree
  • Custom filter function

Contribute

  1. Fork it (https://github.com/xrr2016/flutter_tree.git)
  2. Create your feature branch (git checkout -b feature/foo)
  3. Commit your changes (git commit -am 'Add some foo')
  4. Push to the branch (git push origin feature/foo)
  5. Create a new Pull Request

License

MIT

Stargazers over time

Stargazers over time

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].