rect method

void rect({
  1. required Rect rect,
  2. BorderRadius? borderRadius,
})

Implementation

void rect({
  required Rect rect,
  BorderRadius? borderRadius,
}) {
  if (borderRadius == null) {
    _paintingContext.canvas //
      ..drawRect(rect, _paintingContext.fillPaint) //
      ..drawRect(rect, _paintingContext.strokePaint);
  } else {
    final rrect = RRect.fromRectAndCorners(
      rect,
      topLeft: borderRadius.topLeft,
      topRight: borderRadius.topRight,
      bottomLeft: borderRadius.bottomLeft,
      bottomRight: borderRadius.bottomRight,
    );
    _paintingContext.canvas //
      ..drawRRect(rrect, _paintingContext.fillPaint) //
      ..drawRRect(rrect, _paintingContext.strokePaint);
  }

  _paintingContext.markHasUnappliedCanvasCommands();
}