pushOpacity method
Blend further painting with an alpha value.
offsetis the offset from the origin of the canvas' coordinate system to the origin of the caller's coordinate system.alphais the alpha value to use when blending the painting done bypainter. An alpha value of 0 means the painting is fully transparent and an alpha value of 255 means the painting is fully opaque.painteris a callback that will paint with thealphaapplied. This function calls thepaintersynchronously.
A RenderObject that uses this function is very likely to require its RenderObject.alwaysNeedsCompositing property to return true. That informs ancestor render objects that this render object will include a composited layer, which, for example, causes them to use composited clips.
Implementation
void pushOpacity(Offset offset, int alpha, PaintingContextCallback painter) {
pushLayer(OpacityLayer(alpha: alpha, offset: offset), painter, Offset.zero);
}