drawRectangleMarker method

void drawRectangleMarker(
  1. Canvas canvas,
  2. double x,
  3. double y,
  4. DataMarkerStyle style,
)

Implementation

void drawRectangleMarker(Canvas canvas, double x, double y, DataMarkerStyle style) {
  final rect = Rect.fromCenter(
    center: Offset(x, y),
    width: style.width,
    height: style.height,
  );

  final fillPaint = Paint()
    ..color = style.color
    ..style = PaintingStyle.fill;

  final borderPaint = Paint()
    ..color = style.borderColor
    ..strokeWidth = style.borderWidth
    ..style = PaintingStyle.stroke;

  canvas.drawRect(rect, fillPaint);
  if (style.borderWidth > 0) {
    canvas.drawRect(rect, borderPaint);
  }
}