opacity property

double get opacity

The fraction to scale the child's alpha value.

An opacity of 1.0 is fully opaque. An opacity of 0.0 is fully transparent (i.e., invisible).

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

Implementation

double get opacity => _opacity;
set 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();
  }
  markNeedsCompositedLayerUpdate();
  if (wasVisible != (_alpha != 0) && !alwaysIncludeSemantics) {
    markNeedsSemanticsUpdate();
  }
}