draw static method
void
draw(
- Widget widget, {
- PdfPage? page,
- PdfGraphics? canvas,
- BoxConstraints? constraints,
- required PdfPoint offset,
- Alignment? 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,
Alignment? 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 d = alignment.withinRect(widget.box!);
offset = PdfPoint(offset.x - d.x, offset.y - d.y);
}
widget.box = PdfRect.fromPoints(offset, widget.box!.size);
widget.paint(context);
}