draw static method
void
draw(
- Widget widget, {
- PdfPage? page,
- PdfGraphics? canvas,
- BoxConstraints? constraints,
- required PdfPoint offset,
- AlignmentGeometry? alignment,
- Context? context,
Draw a widget to a page canvas.
Implementation
static void draw(
Widget widget, {
PdfPage? page,
PdfGraphics? canvas,
BoxConstraints? constraints,
required PdfPoint offset,
AlignmentGeometry? alignment,
Context? context,
}) {
context ??= Context(
document: page!.pdfDocument,
page: page,
canvas: canvas!,
).inheritFromAll(<Inherited>[
ThemeData.base(),
]);
widget.layout(
context,
constraints ?? const BoxConstraints(),
);
assert(widget.box != null);
if (alignment != null) {
final resolvedAlignment = alignment.resolve(Directionality.of(context));
final d = resolvedAlignment.withinRect(widget.box!);
offset = PdfPoint(offset.x - d.x, offset.y - d.y);
}
widget.box = PdfRect.fromPoints(offset, widget.box!.size);
widget.paint(context);
}