Protected against bots by Yandex SmartCaptcha. Data processing policy
Stack
Lays its children on top of each other. Used for overlays, badges and text over images.
Type:
multi-child
Stack alignment:bottomLeft
Image src:"https://example.com/bg.jpg" fit:cover
Positioned bottom:12 left:12
Text "Title"
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
alignment
|
string | topStart |
Alignment of non-positioned children:
topLeft
,
topCenter
,
topRight
,
centerLeft
,
center
,
centerRight
,
bottomLeft
,
bottomCenter
,
bottomRight
|
fit
|
string | loose |
Size of non-positioned children:
loose
,
expand
,
passthrough
|
clipBehavior
|
string | hardEdge |
Clipping of what goes past the bounds:
none
,
hardEdge
,
antiAlias
,
antiAliasWithSaveLayer
|
Positioned
Places its child inside a Stack at absolute coordinates.
Type:
single-child
Positioned top:10 right:10
Text "Badge"
Parameters
| Parameter | Type | Description |
|---|---|---|
top
|
double | Offset from the top edge |
bottom
|
double | Offset from the bottom edge |
left
|
double | Offset from the left edge |
right
|
double | Offset from the right edge |
width
|
double | Width |
height
|
double | Height |
All parameters are optional. Unspecified sides stay free.
Examples
Card with a badge
SizedBox width:200 height:200
Stack clipBehavior:none
ColoredBox color:#36345E
Positioned top:12 right:12
DecoratedBox
#decoration color:#FF4444
#borderRadius circular 30
Padding
#padding symmetric horizontal:8 vertical:4
Text "NEW"
#style fontSize:12 color:#FFFFFF
Gradient over an image
Stack
SizedBox width:512 height:288
Image src:"https://example.com/poster.jpg" fit:cover
Positioned bottom:0 left:0 right:0 height:100
DecoratedBox
#decoration
#gradient linear begin:bottomCenter end:topCenter
#colors 0xFF000000 0x00000000
See also
- Align — placing a single element by alignment