paint method
Draw itself and its children, according to the calculated
box.offset
Implementation
@override
void paint(Context context) {
super.paint(context);
if (_context.lastLine == 0) {
return;
}
final mat = Matrix4.identity();
mat.translate(box!.x, box!.y);
context.canvas
..saveContext()
..setTransform(mat);
var index = 0;
for (final row in children) {
if (index++ < _context.firstLine && !row.repeat) {
continue;
}
if (row.decoration != null) {
var y = double.infinity;
var h = 0.0;
for (final child in row.children) {
y = math.min(y, child.box!.y);
h = math.max(h, child.box!.height);
}
row.decoration!.paint(
context,
PdfRect(0, y, box!.width, h),
PaintPhase.background,
);
}
for (final child in row.children) {
context.canvas
..saveContext()
..drawRect(
child.box!.x, child.box!.y, child.box!.width, child.box!.height)
..clipPath();
child.paint(context);
context.canvas.restoreContext();
}
if (index >= _context.lastLine) {
break;
}
}
index = 0;
for (final row in children) {
if (index++ < _context.firstLine && !row.repeat) {
continue;
}
if (row.decoration != null) {
var y = double.infinity;
var h = 0.0;
for (final child in row.children) {
y = math.min(y, child.box!.y);
h = math.max(h, child.box!.height);
}
row.decoration!.paint(
context,
PdfRect(0, y, box!.width, h),
PaintPhase.foreground,
);
}
if (index >= _context.lastLine) {
break;
}
}
context.canvas.restoreContext();
if (border != null) {
border!.paintTable(context, box!, _widths, _heights);
}
}