rectPainting method

void rectPainting(
  1. Canvas canvas,
  2. Size canvasSize,
  3. Color color,
  4. double rectSize,
  5. double xOffset,
  6. double yOffset, {
  7. double? radius,
})

Implementation

void rectPainting(Canvas canvas, Size canvasSize, Color color,
    double rectSize, double xOffset, double yOffset,
    {double? radius}) {
  final paint = new Paint();
  paint.color = color;

  var center = Offset(canvasSize.width / 2, canvasSize.height / 2);

  canvas.drawRRect(
      RRect.fromLTRBR(
          center.dx.roundToDouble() - (rectSize / 2) + xOffset,
          center.dy.roundToDouble() - (rectSize / 2) + yOffset,
          center.dx.roundToDouble() + (rectSize / 2) + xOffset,
          center.dy.roundToDouble() + (rectSize / 2) + yOffset,
          Radius.circular(radius ?? 0)),
      paint);
}