Positioning constraints
Only two of the three horizontal values (left, right, width) may be set; at least one must be omitted or null. Similarly, only two of the three vertical values (top, bottom, height) may be set; at least one must be omitted or null.
Properties
| Property | Type | Description |
|---|---|---|
| left | double? | The distance from the left edge of the stack. |
| top | double? | The distance from the top edge of the stack. |
| right | double? | The distance from the right edge of the stack. |
| bottom | double? | The distance from the bottom edge of the stack. |
| width | double? | The width of the positioned child. |
| height | double? | The height of the positioned child. |
| child | StacWidget | The widget to position within the stack. |
The Dart API also supports named constructors:
StacPositioned.fill(), StacPositioned.fromRect(), StacPositioned.fromRelativeRect(), and StacPositioned.directional(). These are not available in JSON format.Example
Dart-Only Constructors
The following named constructors are available in Dart but not in JSON:StacPositioned.fill()
Creates a positioned widget with left, top, right, and bottom defaulting to 0.0, so the child fills the stack unless overridden.
StacPositioned.fromRect()
Creates a positioned widget from a StacRect, setting left, top, width, and height. right and bottom are set to null.
StacPositioned.fromRelativeRect()
Creates a positioned widget from relative edges: left, top, right, and bottom are required; width and height are null.
StacPositioned.directional()
Creates a positioned widget using start and end instead of left and right. The mapping depends on textDirection: for LTR, start → left and end → right; for RTL, the opposite. Only two of start, end, and width may be set; only two of top, bottom, and height may be set.