A Flutter package for a fully customisable tree view
Add this to your pubspec.yaml
file
dependencies:
tree_view: ^0.0.5
And run
flutter packages get
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
Resume.docx
andBilling-Info.docx
are Child widgets withdocuments
as the Parent.documents
,MeetingReport.xls
,MeetingReport.xls
andDemo.zip
are Child widgets withDesktop
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'),
],
),
),
],
);