clipPath method
void
clipPath({})
Pushes a ClipPathLayer 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 clipPath({
required Path path,
required VoidCallback paint,
Clip clipBehavior = Clip.antiAlias,
Offset offset = Offset.zero,
Rect? bounds,
LayerKey? key,
}) {
final offsetClipPath = path.shift(offset + _render.paintOffset!);
ClipPathLayer layer;
if (key?.layer is ClipPathLayer) {
layer = (key!.layer! as ClipPathLayer)
..clipPath = offsetClipPath
..clipBehavior = clipBehavior;
} else {
layer = ClipPathLayer(
clipPath: offsetClipPath,
clipBehavior: clipBehavior,
);
key?.layer = layer;
}
push(layer: layer, paint: paint, offset: offset, bounds: bounds);
}