opacity method

void opacity({
  1. required double opacity,
  2. required VoidCallback paint,
  3. Offset offset = Offset.zero,
  4. Rect? bounds,
  5. LayerKey<Layer>? key,
})

Pushes an OpacityLayer to the compositing tree, calling paint to paint on top of the layer.

This is the same as alpha but takes a fraction instead of an integer, where 0.0 means the painting is fully transparent and an opacity value of

See also:

Implementation

//  1.0 means the painting is fully opaque.
///
/// See also:
///
///  * [PaintingContext.pushOpacity]
void opacity({
  required double opacity,
  required VoidCallback paint,
  Offset offset = Offset.zero,
  Rect? bounds,
  LayerKey? key,
}) {
  return alpha(
    alpha: (opacity * 255).round(),
    paint: paint,
    offset: offset,
    bounds: bounds,
    key: key,
  );
}