pushClipRect method
Clip further painting using a rectangle.
needsCompositingis whether the child needs compositing. Typically matches the value of RenderObject.needsCompositing for the caller.offsetis the offset from the origin of the canvas' coordinate system to the origin of the caller's coordinate system.clipRectis rectangle (in the caller's coordinate system) to use to clip the painting done bypainter.painteris a callback that will paint with theclipRectapplied. This function calls thepaintersynchronously.clipBehaviorcontrols how the rectangle is clipped.
Implementation
void pushClipRect(bool needsCompositing, Offset offset, Rect clipRect, PaintingContextCallback painter, {Clip clipBehavior = Clip.hardEdge}) {
final Rect offsetClipRect = clipRect.shift(offset);
if (needsCompositing) {
pushLayer(ClipRectLayer(clipRect: offsetClipRect, clipBehavior: clipBehavior), painter, offset, childPaintBounds: offsetClipRect);
} else {
clipRectAndPaint(offsetClipRect, clipBehavior, offsetClipRect, () => painter(this, offset));
}
}