drawRoundRect method

void drawRoundRect(
  1. int x,
  2. int y,
  3. int width,
  4. int height,
  5. int borderRadius,
  6. Color color,
  7. double thickness,
)

Implementation

void drawRoundRect(
  int x,
  int y,
  int width,
  int height,
  int borderRadius,
  ui.Color color,
  double thickness,
) {
  _changed = true;
  final halfThickness = (thickness / 2).round().clamp(0, 999999);
  final rrect = ui.RRect.fromRectAndRadius(
    ui.Rect.fromLTWH(
      (x + halfThickness).toDouble(),
      (y + halfThickness).toDouble(),
      (width - halfThickness * 2).toDouble(),
      (height - halfThickness * 2).toDouble(),
    ),
    ui.Radius.circular(borderRadius.toDouble()),
  );
  _canvas.drawRRect(rrect, _paint(color, strokeWidth: thickness));
}