https://github.com/ajilo297/flutter_tree_view
A Flutter package to create an easily customisable Tree View
https://github.com/ajilo297/flutter_tree_view
dart flutter flutter-package tree treeview
Last synced: 4 months ago
JSON representation
A Flutter package to create an easily customisable Tree View
- Host: GitHub
- URL: https://github.com/ajilo297/flutter_tree_view
- Owner: ajilo297
- License: mit
- Created: 2018-12-31T07:19:28.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-08-29T17:05:55.000Z (about 2 years ago)
- Last Synced: 2025-06-28T06:45:00.109Z (4 months ago)
- Topics: dart, flutter, flutter-package, tree, treeview
- Language: Dart
- Homepage:
- Size: 88.9 KB
- Stars: 66
- Watchers: 4
- Forks: 19
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://pub.dartlang.org/packages/tree_view)
[](https://travis-ci.org/ajilo297/flutter_tree_view)
[](https://opensource.org/licenses/MIT)
# Tree View
A Flutter package for a fully customisable tree view
### Installing
Add this to your `pubspec.yaml` file
```yaml
dependencies:
tree_view: ^0.0.5
```
And run
```sh
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
```dart
var treeView = TreeView(
parentList: [
Parent(
parent: Text('Desktop'),
childList: ChildList(
children: [
Parent(
parent: Text('documents'),
childList: ChildList(
children: [
Text('Resume.docx'),
Text('Billing-Info.docx'),
],
),
),
Text('MeetingReport.xls'),
Text('MeetingReport.pdf'),
Text('Demo.zip'),
],
),
),
],
);
```
