StacContainer class

A Stac model representing Flutter's Container widget.

Combines styling, positioning, and sizing properties for child widgets. Supports padding, margins, colors, decorations, sizing, and alignment.

StacContainer(
  padding: StacEdgeInsets.all(16.0),
  color: StacColors.red,
  child: StacText(data: 'Hello'),
)
{
  "type": "container",
  "padding": {"all": 16.0},
  "color": "#FF0000",
  "child": {"type": "text", "data": "Hello"}
}
Inheritance
Annotations
  • @JsonSerializable.new()

Constructors

StacContainer({StacAlignment? alignment, StacEdgeInsets? padding, StacColor? color, StacBoxDecoration? decoration, StacBoxDecoration? foregroundDecoration, double? width, double? height, StacBoxConstraints? constraints, StacEdgeInsets? margin, StacAlignment? transformAlignment, StacWidget? child, StacClip? clipBehavior})
Creates a StacContainer with optional styling properties.
const
StacContainer.fromJson(Map<String, dynamic> json)
Creates a StacContainer from JSON.
factory

Properties

alignment → StacAlignment?
How to align the child within the container.
final
child → StacWidget?
The child widget contained within this container.
final
clipBehavior → StacClip?
How to clip the container's content.
final
color → StacColor?
Background color. Cannot be used with decoration.
final
constraints → StacBoxConstraints?
Size constraints for the container.
final
decoration → StacBoxDecoration?
Background decoration (borders, gradients, shadows).
final
foregroundDecoration → StacBoxDecoration?
Foreground decoration painted over the child.
final
hashCode → int
The hash code for this object.
no setterinherited
height → double?
Fixed height. If null, expands to fill available space. Supports string values like "20" or "infinite".
final
jsonData → Map<String, dynamic>?
Raw JSON data for this widget
finalinherited
margin → StacEdgeInsets?
Outer spacing around the container.
final
padding → StacEdgeInsets?
Inner spacing around the child.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transformAlignment → StacAlignment?
Transform alignment for the container.
final
type → String
Widget type identifier.
no setteroverride
width → double?
Fixed width. If null, expands to fill available space. Supports string values like "20" or "infinite".
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
Converts this container to JSON.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited