Skip to main content
The Stac Container allows you to build a 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.
colorStacColorThe 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.
transformAlignmentStacAlignmentThe alignment of the transform origin.
childStacWidgetThe child widget of the container.
clipBehaviorStacClipThe clip behavior of the container.

Example

StacContainer(
  alignment: StacAlignment.center,
  padding: StacEdgeInsets(
    top: 16.0,
    bottom: 16.0,
    left: 16.0,
    right: 16.0,
  ),
  decoration: StacBoxDecoration(
    color: '#FF5733',
    borderRadius: StacBorderRadius(
      topLeft: 16.0,
      topRight: 16.0,
      bottomLeft: 16.0,
      bottomRight: 16.0,
    ),
  ),
  width: 200.0,
  height: 200.0,
  child: StacText(
    data: 'Hello, World!',
    style: StacTextStyle(
      color: StacColors.white,
      fontSize: 24.0,
    ),
  ),
)