build method

  1. @override
Widget build(
  1. BuildContext context,
  2. List<TreeNodeDepth> depth,
  3. int index
)
override

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,
    ),
  );
}