Flutter Tree
Install
dependencies :
flutter_tree : ^1.0.0
Uasge
TreeNode
TreeNode (
title: Text ('This is a title!' ),
children: [
TreeNode (
title: Text ('This is a title!' ),
children: < Widget > [
TreeNode (title: Text ('This is a title!' )),
],
),
],
)
TreeView
final List <Map <String , dynamic >> treeData = [
{
"title" : "Title" ,
"expand" : true ,
"children" : [
{
"title" : "Title" ,
"expand" : true ,
"children" : [],
},
],
}
];
TreeView (
data: treeData,
titleOnTap: () {
print ('title' );
},
leadingOnTap: () {
print ('leading' );
},
trailingOnTap: () {
print ('trailing' );
},
)
Config
TreeNode
property
type
default
description
required
level
int
0
Item indent level
false
expand
boolean
false
Item is expand
false
offsetLeft
double
24.0
Item padding left
false
children
double
List<Widget>
Children widget
[]
title
Widget
Text('Title')
Title Widget
false
leading
Widget
IconButton()
Leading widget
false
trailing
Widget
IconButton()
Trailing widget
false
titleOnTap
Fuction
null
Title tap callback
false
leadingOnTap
Fuction
null
Leading tap callback
false
trailingOnTap
Fuction
null
Trailing tap Callback
false
TreeView
property
type
default
description
required
data
List<Map<String, dynamic>>
null
Tree data
true
titleKey
string
title
Title key in map
false
leadingKey
string
leading
Leading key in map
false
expandKey
string
expand
Expand key in map
false
childrenKey
string
children
Children key in map
false
offsetLeft
double
24.0
Item padding left
false
titleOnTap
Fuction
null
Title tap callback
false
leadingOnTap
Fuction
null
Leading tap callback
false
trailingOnTap
Fuction
null
Trailing tap Callback
false
Contribute
Fork it (https://github.com/xrr2016/flutter_tree.git )
Create your feature branch (git checkout -b feature/foo)
Commit your changes (git commit -am 'Add some foo')
Push to the branch (git push origin feature/foo)
Create a new Pull Request
License
MIT