paint method
Draw itself and its children, according to the calculated
box.offset
Implementation
@override
void paint(Context context) {
super.paint(context);
if (child != null) {
final resolvedAlignment = alignment.resolve(Directionality.of(context));
final childSize = child!.box!.size;
final sizes = applyBoxFit(fit, childSize, box!.size);
final scaleX = sizes.destination!.x / sizes.source!.x;
final scaleY = sizes.destination!.y / sizes.source!.y;
final sourceRect = resolvedAlignment.inscribe(
sizes.source!, PdfRect.fromPoints(PdfPoint.zero, childSize));
final destinationRect =
resolvedAlignment.inscribe(sizes.destination!, box!);
final mat =
Matrix4.translationValues(destinationRect.x, destinationRect.y, 0)
..scale(scaleX, scaleY, 1)
..translate(-sourceRect.x, -sourceRect.y);
context.canvas
..saveContext()
..drawBox(box!)
..clipPath()
..setTransform(mat);
child!.paint(context);
context.canvas.restoreContext();
}
}