push method
void
push({
- required VoidCallback paint,
- ContainerLayer? layer,
- Rect? bounds,
- Offset offset = Offset.zero,
Pushes a ContainerLayer to the current recording, 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 push({
required VoidCallback paint,
ContainerLayer? layer,
Rect? bounds,
Offset offset = Offset.zero,
}) {
final oldContext = _render.paintingContext;
final oldOffset = _render.paintOffset;
try {
if (layer == null) {
paint();
} else {
oldContext!.pushLayer(
layer,
(context, offset) {
_render.paintingContext = context;
_render.paintOffset = offset;
paint();
},
offset + _render.paintOffset!,
childPaintBounds: bounds,
);
}
} finally {
_render.paintingContext = oldContext;
_render.paintOffset = oldOffset;
}
}