paint method
Implementation
@protected
void paint(Widget child, Context context) {
final margin = resolvedMargin!;
final box = PdfRect(
margin.left,
margin.bottom,
pageFormat.width - margin.horizontal,
pageFormat.height - margin.vertical,
);
if (pageTheme.clip) {
context.canvas
..saveContext()
..drawRect(box.x, box.y, box.width, box.height)
..clipPath();
}
if (pageTheme.textDirection == TextDirection.rtl) {
child.box = PdfRect(
((mustRotate ? box.height : box.width) - child.box!.width) +
child.box!.x,
child.box!.y,
child.box!.width,
child.box!.height,
);
}
if (mustRotate) {
final margin = resolvedMargin!;
context.canvas
..saveContext()
..setTransform(Matrix4.identity()
..rotateZ(-math.pi / 2)
..translate(
-pageFormat.height - margin.left + margin.top,
-pageFormat.height + pageFormat.width + margin.top - margin.right,
));
child.paint(context);
context.canvas.restoreContext();
} else {
child.paint(context);
}
if (pageTheme.clip) {
context.canvas.restoreContext();
}
}