opacity property

double opacity

The fraction to scale the child's alpha value.

An opacity of one is fully opaque. An opacity of zero is fully transparent (i.e. invisible).

Values one and zero are painted with a fast path. Other values require painting the child into an intermediate buffer, which is expensive.

Implementation

double get opacity => _opacity;
void opacity=(double value)

Implementation

set opacity(double value) {
  assert(value >= 0.0 && value <= 1.0);
  if (_opacity == value) {
    return;
  }
  final bool didNeedCompositing = alwaysNeedsCompositing;
  final bool wasVisible = _alpha != 0;
  _opacity = value;
  _alpha = ui.Color.getAlphaFromOpacity(_opacity);
  if (didNeedCompositing != alwaysNeedsCompositing) {
    markNeedsCompositingBitsUpdate();
  }
  markNeedsPaint();
  if (wasVisible != (_alpha != 0) && !alwaysIncludeSemantics) {
    markNeedsSemanticsUpdate();
  }
}