drawObject method

  1. @override
void drawObject(
  1. Canvas canvas,
  2. Paint paint
)
override

Implementation

@override
void drawObject(Canvas canvas, Paint paint) {
  if (arrowFoot == null) {
    super.drawObject(canvas, paint);
  } else {
    var path = Path();
    path.moveTo(location.dx + borderRadius.x, location.dy);
    if (arrowFoot![0]
            .distanceToLine(location, location.translate(size.width, 0)) <
        5) {
      _drawArrow(path);
    }
    path.lineTo(location.dx + size.width - borderRadius.x, location.dy);
    path.arcToPoint(
        Offset(location.dx + size.width, location.dy + borderRadius.y),
        radius: borderRadius);
    if (arrowFoot![0].distanceToLine(location.translate(size.width, 0),
            location.translate(size.width, size.height)) <
        5) {
      _drawArrow(path);
    }
    path.lineTo(
        location.dx + size.width, location.dy + size.height - borderRadius.y);
    path.arcToPoint(
        Offset(location.dx + size.width - borderRadius.x,
            location.dy + size.height),
        radius: borderRadius);
    if (arrowFoot![0].distanceToLine(
            location.translate(size.width, size.height),
            location.translate(0, size.height)) <
        5) {
      _drawArrow(path);
    }
    path.lineTo(location.dx + borderRadius.x, location.dy + size.height);
    path.arcToPoint(
        Offset(location.dx, location.dy + size.height - borderRadius.y),
        radius: borderRadius);
    if (arrowFoot![0]
            .distanceToLine(location.translate(0, size.height), location) <
        5) {
      _drawArrow(path);
    }
    path.lineTo(location.dx, location.dy + borderRadius.y);
    path.arcToPoint(Offset(location.dx + borderRadius.x, location.dy),
        radius: borderRadius);
    canvas.drawPath(path, paint);
  }
}