paintChild method
Paints child at its offset, cut off at its bounds. A child the clip
leaves no cell of is not painted, nor anything inside it, unless
something inside it is paintedWhenCutOff; one not painted keeps
what it kept of its paint, since its cells are as it left them.
Implementation
void paintChild(PaintContext ctx, RenderObject child) {
final at = child.parentData;
final canvas = ctx.canvas
..save()
..translate(at.dx, at.dy)
..clipRect(0, 0, child.width, child.height);
// an empty clip is (0, 0, 0, 0)
final (x0, _, x1, _) = canvas.clipBounds;
if (x0 < x1 || child._cutOffPainters != 0) {
// painted from its parent, over what the parent painted in its
// cells: it can't rely on what it painted before
if (child.keepsUnderlay && child.isRepaintBoundary) {
child._keepUnderlay(canvas);
}
child
..invalidatePaintCache()
.._paint(ctx);
}
canvas.restore();
}