paint method
Draw itself and its children, according to the calculated
box.offset
Implementation
@override
void paint(Context context) {
super.paint(context);
final bf = PdfButtonField(
rect: context.localToGlobal(box!),
fieldName: name,
flags: flags,
fieldFlags: <PdfFieldFlags>{PdfFieldFlags.pushButton},
);
final mat = context.canvas.getTransform();
final translation = Vector3(0, 0, 0);
final rotation = Quaternion(0, 0, 0, 0);
final scale = Vector3(0, 0, 0);
mat
..decompose(translation, rotation, scale)
..leftTranslate(-translation.x, -translation.y)
..translate(box!.x, box!.y);
var canvas = bf.appearance(context.document, PdfAnnotAppearance.normal,
matrix: mat, boundingBox: box);
Widget.draw(
child!,
offset: PdfPoint.zero,
canvas: canvas,
page: context.page,
constraints:
BoxConstraints.tightFor(width: box!.width, height: box!.height),
);
canvas = bf.appearance(context.document, PdfAnnotAppearance.down,
matrix: mat, boundingBox: box);
Widget.draw(
_childDown,
offset: PdfPoint.zero,
canvas: canvas,
page: context.page,
constraints:
BoxConstraints.tightFor(width: box!.width, height: box!.height),
);
canvas = bf.appearance(context.document, PdfAnnotAppearance.rollover,
matrix: mat, boundingBox: box);
Widget.draw(
_childRollover,
offset: PdfPoint.zero,
canvas: canvas,
page: context.page,
constraints:
BoxConstraints.tightFor(width: box!.width, height: box!.height),
);
PdfAnnot(context.page, bf);
}