Skip to main content

Positioned

The Stac Positioned allows you to build a Flutter positioned widget using JSON. To know more about the positioned widget in Flutter, refer to the official documentation.

Properties​

PropertyTypeDescription
positionedTypeStacPositionedType?The type of positioned widget. Can be directional, fill, or fromRect.
leftdouble?The distance from the left edge of the parent.
topdouble?The distance from the top edge of the parent.
rightdouble?The distance from the right edge of the parent.
bottomdouble?The distance from the bottom edge of the parent.
widthdouble?The width of the child.
heightdouble?The height of the child.
startdouble?The distance from the start edge of the parent (for directional type).
enddouble?The distance from the end edge of the parent (for directional type).
textDirectionTextDirectionThe text direction to use for resolving start and end. Defaults to TextDirection.ltr.
rectStacRect?The rectangle to position the child (for fromRect type).
childMap<String, dynamic>?The widget to display inside the positioned widget.

Example JSON​

{
"type": "positioned",
"left": 10,
"top": 20,
"right": 30,
"bottom": 40,
"child": {
"type": "text",
"data": "Hello, World!"
}
}

Example JSON for directional​

{
"type": "positioned",
"positionedType": "directional",
"start": 10,
"top": 20,
"width": 100,
"height": 50,
"textDirection": "ltr",
"child": {
"type": "text",
"data": "Hello, World!"
}
}

Example JSON for fill​

{
"type": "positioned",
"positionedType": "fill",
"left": 10,
"top": 20,
"right": 30,
"bottom": 40,
"child": {
"type": "text",
"data": "Hello, World!"
}
}

Example JSON for fromRect​

{
"type": "positioned",
"positionedType": "fromRect",
"rect": {
"left": 10,
"top": 20,
"right": 110,
"bottom": 70
},
"child": {
"type": "text",
"data": "Hello, World!"
}
}