drawBorder method

  1. @override
void drawBorder(
  1. Canvas canvas,
  2. Rect rect
)
override

Draws a custom border for the circle shape.

This method is called when the shape needs to draw its border. The border is only drawn if borderWidth is greater than 0. The border is drawn as a circle with radius adjusted to account for the border width.

canvas - The canvas on which to draw the border. rect - The bounding rectangle that defines the drawing area.

Implementation

@override
void drawBorder(Canvas canvas, Rect rect) {
  if (this.borderWidth > 0) {
    borderPaint.color = this.borderColor;
    borderPaint.strokeWidth = this.borderWidth;
    canvas.drawCircle(
      rect.center,
      min(
        (rect.width - borderWidth) / 2.0,
        (rect.height - borderWidth) / 2.0,
      ),
      borderPaint,
    );
  }
}