clipRect method
void
clipRect({})
Pushes a ClipRectLayer to the compositing tree, calling paint
to paint
on top of the layer.
The bounds
argument defines the bounds in which the paint
should
paint, this is useful for debugging tools and does not affect rendering.
See also:
Implementation
void clipRect({
required Rect rect,
required VoidCallback paint,
Clip clipBehavior = Clip.antiAlias,
Offset offset = Offset.zero,
Rect? bounds,
LayerKey? key,
}) {
final offsetClipRect = rect.shift(offset + _render.paintOffset!);
ClipRectLayer layer;
if (key?.layer is ClipRectLayer) {
layer = (key!.layer! as ClipRectLayer)
..clipRect = offsetClipRect
..clipBehavior = clipBehavior;
} else {
layer = ClipRectLayer(
clipRect: offsetClipRect,
clipBehavior: clipBehavior,
);
key?.layer = layer;
}
push(layer: layer, paint: paint, offset: offset, bounds: bounds);
}