Flutter Tree

GitHub stars pub package test

example

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",
    "expaned": true,
    "children": [
      {
        "title": "Title",
        "expaned": true,
        "children": [],
      },
    ],
  }
];

TreeView(
  data: treeData,
  titleOnTap: () {
    print('title');
  },
  leadingOnTap: () {
    print('leading');
  },
  trailingOnTap: () {
    print('trailing');
  },
)

Config

TreeNode

propertytypedefaultdescriptionrequired
levelint0Item indent levelfalse
expanedbooleanfalseItem is expanedfalse
offsetLeftdouble24.0Item padding leftfalse
childrendoubleList<Widget>Children widget[]
titleWidgetText('Title')Title Widgetfalse
leadingWidgetIconButton()Leading widgetfalse
trailingWidgetIconButton()Trailing widgetfalse
titleOnTapFuctionnullTitle tap callbackfalse
leadingOnTapFuctionnullLeading tap callbackfalse
trailingOnTapFuctionnullTrailing tap Callbackfalse

TreeView

propertytypedefaultdescriptionrequired
dataList<Map<String, dynamic>>nullTree datatrue
titleKeystringtitleTitle key in mapfalse
leadingKeystringleadingLeading key in mapfalse
expanedKeystringexpanedExpaned key in mapfalse
childrenKeystringchildrenChildren key in mapfalse
offsetLeftdouble24.0Item padding leftfalse
titleOnTapFuctionnullTitle tap callbackfalse
leadingOnTapFuctionnullLeading tap callbackfalse
trailingOnTapFuctionnullTrailing tap Callbackfalse

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

Libraries

flutter_tree