build method
Builds the visual representation of branch lines for a tree node.
Creates a widget that shows the connection lines between tree nodes based on the node's position in the hierarchy and its depth information.
Parameters:
context
(BuildContext): Build context for theme accessdepth
(Listindex
(int): Index within the current depth level
Returns: A Widget representing the branch line visualization
Implementation
@override
Widget build(BuildContext context, List<TreeNodeDepth> depth, int index) {
bool top = true;
bool right = true;
bool bottom = true;
bool left = false;
if (index >= 0) {
final current = depth[index];
if (index != depth.length - 1) {
right = false;
if (current.childIndex >= current.childCount - 1) {
top = false;
}
}
if (current.childIndex >= current.childCount - 1) {
bottom = false;
}
} else {
left = true;
top = false;
bottom = false;
}
return CustomPaint(
painter: _PathPainter(
color: color ?? Theme.of(context).colorScheme.border,
top: top,
right: right,
bottom: bottom,
left: left,
),
);
}