paint method
void
paint(
- Canvas canvas,
- Offset center,
- Size size,
- Paint fillPaint,
- Paint? borderPaint, {
- ShapeDirection? orientation,
- bool isPointingOutward = false,
override
Paints the marker shape on the given canvas.
Parameters:
canvas: The canvas to draw oncenter: The center position of the shapesize: The size of the shape (width and height)fillPaint: Paint to use for filling the shapeborderPaint: Optional paint to use for the border/strokeorientation: 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);
}
}