ajilo297 / flutter_tree_view

A Flutter package to create an easily customisable Tree View

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pub package Build Status License: MIT

Tree View

A Flutter package for a fully customisable tree view

Installing

Add this to your pubspec.yaml file

dependencies:
  tree_view: ^0.0.5

And run

flutter packages get

Example

Let's assume we want to show a tree view with this structure:

Desktop
|-- documents
|   |-- Resume.docx
|   |-- Billing-Info.docx
|-- MeetingReport.xls
|-- MeetingReport.pdf
|-- Demo.zip

In this example

  1. Resume.docx and Billing-Info.docx are Child widgets with documents as the Parent.
  2. documents, MeetingReport.xls, MeetingReport.xls and Demo.zip are Child widgets with Desktop as a Parent widget.

The TreeView would look like this

var treeView = TreeView(
  parentList: [
    Parent(
      parent: Text('Desktop'),
      childList: ChildList(
        children: <Widget>[
          Parent(
            parent: Text('documents'),
            childList: ChildList(
              children: <Widget>[
                Text('Resume.docx'),
                Text('Billing-Info.docx'),
              ],
            ),
          ),
          Text('MeetingReport.xls'),
          Text('MeetingReport.pdf'),
          Text('Demo.zip'),
        ],
      ),
    ),
  ],
);

Sample

About

A Flutter package to create an easily customisable Tree View

License:MIT License


Languages

Language:Dart 85.6%Language:Objective-C 5.4%Language:Shell 4.0%Language:Java 3.1%Language:Kotlin 1.9%