Skip to main content

Container

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

Properties​

PropertyTypeDescription
alignmentStacAlignmentThe alignment of the child within the container.
paddingStacEdgeInsetsThe padding to apply around the child.
decorationStacBoxDecorationThe decoration to paint behind the child.
foregroundDecorationStacBoxDecorationThe decoration to paint in front of the child.
colorStringThe hex color to paint behind the child.
widthdoubleThe width of the container.
heightdoubleThe height of the container.
constraintsStacBoxConstraintsAdditional constraints to apply to the container.
marginStacEdgeInsetsThe margin to apply around the container.
childMap<String, dynamic>The child widget of the container.
clipBehaviorClipThe clip behavior of the container.

Example JSON​

{
"type": "container",
"alignment": "center",
"padding": {
"top": 16.0,
"bottom": 16.0,
"left": 16.0,
"right": 16.0
},
"decoration": {
"color": "#FF5733",
"borderRadius": {
"topLeft": 16.0,
"topRight": 16.0,
"bottomLeft": 16.0,
"bottomRight": 16.0
}
},
"width": 200.0,
"height": 200.0,
"child": {
"type": "text",
"data": "Hello, World!",
"style": {
"color": "#FFFFFF",
"fontSize": 24.0
}
}
}