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()
        ..translateByDouble(box!.left, box!.bottom + box!.height, 0, 1)
        ..scaleByDouble(
          box!.width / _boundingBox.width,
          -box!.height / _boundingBox.height,
          1,
          1,
        )
        ..translateByDouble(-_boundingBox.left, -_boundingBox.bottom, 0, 1),
    );

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

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

  context.canvas.restoreContext();
}