paint method

  1. @override
void paint(
  1. Canvas canvas,
  2. Offset center,
  3. Size size,
  4. Paint fillPaint,
  5. Paint? borderPaint, {
  6. ShapeDirection? orientation,
  7. bool isPointingOutward = false,
})
override

Paints the marker shape on the given canvas.

Parameters:

  • canvas: The canvas to draw on
  • center: The center position of the shape
  • size: The size of the shape (width and height)
  • fillPaint: Paint to use for filling the shape
  • borderPaint: Optional paint to use for the border/stroke
  • orientation: Direction the shape is anchored/facing (left, right, top, bottom)
  • isPointingOutward: For asymmetric shapes (triangle, capsuleHalf), whether the tip/arrow points outward. For ports: true for output ports, false for input ports. For connection endpoints: typically true (pointing along connection direction).

Implementation

@override
void paint(
  Canvas canvas,
  Offset center,
  Size size,
  Paint fillPaint,
  Paint? borderPaint, {
  ShapeDirection? orientation,
  bool isPointingOutward = false,
}) {
  final rect = Rect.fromCenter(
    center: center,
    width: size.width,
    height: size.height,
  );
  canvas.drawRect(rect, fillPaint);
  if (borderPaint != null && borderPaint.strokeWidth > 0) {
    canvas.drawRect(rect, borderPaint);
  }
}