offset method
void
offset({
- required Offset offset,
- required VoidCallback paint,
- Rect? bounds,
- LayerKey<
Layer> ? key,
Pushes an OffsetLayer 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 offset({
required Offset offset,
required VoidCallback paint,
Rect? bounds,
LayerKey? key,
}) {
OffsetLayer layer;
if (key?.layer is OffsetLayer) {
layer = (key!.layer! as OffsetLayer)..offset = offset;
} else {
layer = OffsetLayer(offset: offset);
key?.layer = layer;
}
push(layer: layer, paint: paint, bounds: bounds);
}