alpha method
void
alpha({})
Pushes an OpacityLayer to the compositing tree, calling paint
to paint
on top of the layer.
The alpha
argument is the alpha value to use when blending. An alpha
value of 0 means the painting is fully transparent and an alpha value of
255 means the painting is fully opaque.
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 alpha({
required int alpha,
required VoidCallback paint,
Offset offset = Offset.zero,
Rect? bounds,
LayerKey? key,
}) {
OpacityLayer layer;
if (key?.layer is OffsetLayer) {
layer = (key!.layer! as OpacityLayer)..alpha = alpha;
} else {
layer = OpacityLayer(alpha: alpha);
key?.layer = layer;
}
push(layer: layer, paint: paint, offset: offset, bounds: bounds);
}