drawChildLine method

void drawChildLine(
  1. IMindMapNode node,
  2. Canvas canvas
)

Implementation

void drawChildLine(IMindMapNode node, ui.Canvas canvas) {
  List<IMindMapNode> childs = [];
  childs.addAll(node.getRightItems());
  childs.addAll(node.getLeftItems());
  double t = node.getFishbonePosition().dy + (node.getSize()?.height ?? 0);
  for (IMindMapNode child in childs) {
    Paint paint = Paint()
      ..style = PaintingStyle.stroke
      ..strokeCap = StrokeCap.round
      ..strokeWidth = child.getLinkWidth() <= 0 ? 2 : child.getLinkWidth()
      ..color = child.getLinkColor() == Colors.transparent
          ? Colors.black
          : child.getLinkColor();
    if (mindMap.getFishboneMapType() == FishboneMapType.leftToRight) {
      double t2 =
          child.getLinkInOffset() +
          child.getFishbonePosition().dy +
          (child.getSize()?.height ?? 0) / 2;
      canvas.drawLine(
        Offset(child.getFishbonePosition().dx - node.getHSpace() / 2, t),
        Offset(child.getFishbonePosition().dx - node.getHSpace() / 2, t2),
        paint,
      );
      canvas.drawLine(
        Offset(child.getFishbonePosition().dx - node.getHSpace() / 2, t2),
        Offset(child.getFishbonePosition().dx, t2),
        paint,
      );
      drawChildLine(child, canvas);
    } else {
      double t2 =
          child.getLinkInOffset() +
          child.getFishbonePosition().dy +
          (child.getSize()?.height ?? 0) / 2;
      canvas.drawLine(
        Offset(
          child.getFishbonePosition().dx +
              (child.getSize()?.width ?? 0) +
              node.getHSpace() / 2,
          t,
        ),
        Offset(
          child.getFishbonePosition().dx +
              (child.getSize()?.width ?? 0) +
              node.getHSpace() / 2,
          t2,
        ),
        paint,
      );
      canvas.drawLine(
        Offset(
          child.getFishbonePosition().dx +
              (child.getSize()?.width ?? 0) +
              node.getHSpace() / 2,
          t2,
        ),
        Offset(
          child.getFishbonePosition().dx + (child.getSize()?.width ?? 0),
          t2,
        ),
        paint,
      );
      drawChildLine(child, canvas);
    }
  }
}