draw method

  1. @override
void draw(
  1. Canvas canvas,
  2. Rect bounds
)
override

Draws the contents or children of this Drawable to the canvas, using the parentPaint to optionally override the child's paint.

The bounds is not used.

Implementation

@override
void draw(Canvas canvas, Rect bounds) {
  if (!hasDrawableContent) {
    return;
  }

  if (transform != null) {
    canvas.save();
    canvas.transform(transform!);
  }

  if (viewport.viewBoxOffset != Offset.zero) {
    canvas.translate(viewport.viewBoxOffset.dx, viewport.viewBoxOffset.dy);
  }
  for (Drawable child in children) {
    child.draw(canvas, viewport.viewBoxRect);
  }

  if (transform != null) {
    canvas.restore();
  }
}