nodeBuilder property

NodeBuilder nodeBuilder
final

Called, as needed, to build node widgets. Nodes are only built when they're scrolled into view.

If you are using your own widget, make sure to add the indentation to it using TreeNodeScope.indentation. Example:

/* Using Padding: */
@override
Widget build(BuildContext context) {
  final treeNodeScope = TreeNodeScope.of(context);
  return Padding(
    padding: EdgeInsets.only(left: treeNodeScope.indentation),
    child: MyCustomNodeWidget(/* [...] */),
  );
}
/* Using LinesWidget: */
@override
Widget build(BuildContext context) {
  /* This allows the addition of custom Widgets
     at the beginning of each node, like a custom color or button.*/
  return Row(
    children: [
      const LinesWidget(),

      /* add some spacing in between */
      const SizedBox(width: 16),

      /* The content (title, description) */
      MyNodeLabel(/* [...] */),

      /* Align the ExpandNodeIcon to the end */
      const Spacer(),

      /* A button to expand/collapse nodes */
      const ExpandNodeIcon(),
    ],
  );
}

Implementation

final NodeBuilder nodeBuilder;