Protected against bots by Yandex SmartCaptcha. Data processing policy
Opacity
Makes the child transparent: from
1.0
(fully visible) to
0.0
(invisible, but still takes up space).
Type:
single-child
Opacity opacity:0.5
Text "Semi-transparent text"
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
opacity
|
double | 1.0 |
Opacity from
0.0
to
1.0
|
alwaysIncludeSemantics
|
bool | false | Whether to keep an invisible child available to screen readers (app only) |
Examples
A muted caption
Column spacing:4
Text "Main text"
Opacity opacity:0.6
Text "Secondary caption"
Disabled card state
@enabled:false
Opacity opacity:{enabled ? 1.0 : 0.4}
DecoratedBox
#decoration color:#36345E
#borderRadius circular 12
Padding
#padding all 16
Text "Card"
Bad practices
Opacity for a smooth appearance
// BAD — opacity switches the value instantly: without an animation the appearance is a jump
@visible:false
Opacity opacity:{visible ? 1.0 : 0.0}
Text "Appearing"
For a smooth transition use Animation — it animates scale and opacity.
Best practices
-
Invisible ≠ disabled.
At
opacity:0the child still takes up space and receives taps. To remove it from the layout, choose conditional display ( Switcher ), not opacity. -
Do not put
Opacityon large trees for the sake of a color: for a single fill a transparent color is enough (#80FF0000).