paint method

  1. @override
void paint(
  1. Context context
)
override

Draw itself and its children, according to the calculated box.offset

Implementation

@override
void paint(Context context) {
  super.paint(context);

  context.canvas
    ..saveContext()
    ..setTransform(
      Matrix4.identity()
        ..translate(box!.x, box!.y + box!.height)
        ..scale(
          box!.width / _boundingBox.width,
          -box!.height / _boundingBox.height,
        )
        ..translate(-_boundingBox.x, -_boundingBox.y),
    );

  if (fillColor != null) {
    context.canvas
      ..setFillColor(fillColor)
      ..drawShape(shape)
      ..fillPath();
  }

  if (strokeColor != null) {
    context.canvas
      ..setStrokeColor(strokeColor)
      ..drawShape(shape)
      ..strokePath();
  }

  context.canvas.restoreContext();
}