paint method

void paint(
  1. Canvas canvas,
  2. Size size, {
  3. MotionFrame frame = MotionFrame.zero,
})

Paints the figure onto canvas, mapping the 100-by-100 view box onto the largest square centered in size.

Implementation

void paint(ui.Canvas canvas, ui.Size size,
    {MotionFrame frame = MotionFrame.zero}) {
  final side = math.min(size.width, size.height);
  if (side <= 0) return;
  canvas.save();
  canvas.translate((size.width - side) / 2, (size.height - side) / 2);
  canvas.scale(side / viewBoxSize);
  _paintViewed(canvas, frame);
  canvas.restore();
}