StacStack class

A Stac model representing Flutter's Stack widget.

Positions its children relative to the edges of the box. Children are painted in order with the first child being at the bottom. Control layout using alignment, textDirection, fit, and clipBehavior.

{@tool snippet} Dart Example:

StacStack(
  alignment: StacAlignment.center,
  children: const [
    StacContainer(color: '#EEEEEE', width: 200, height: 200),
    StacText(data: 'On top'),
  ],
)

{@end-tool}

{@tool snippet} JSON Example:

{
  "type": "stack",
  "alignment": "center",
  "children": [
    {"type": "container", "color": "#EEEEEE", "width": 200, "height": 200},
    {"type": "text", "data": "On top"}
  ]
}

{@end-tool}

Inheritance
Annotations
  • @JsonSerializable()

Constructors

StacStack.new({StacAlignment? alignment, StacTextDirection? textDirection, StacStackFit? fit, StacClip? clipBehavior, List<StacWidget>? children})
Creates a StacStack that lays out its children relative to its box.
const
StacStack.fromJson(Map<String, dynamic> json)
Creates a StacStack from a JSON map.
factory

Properties

alignment StacAlignment?
How to align non-positioned children within the stack.
final
children List<StacWidget>?
The widgets displayed by this stack, painted in order.
final
clipBehavior StacClip?
Whether to clip children that paint outside the stack's bounds.
final
fit StacStackFit?
How to size non-positioned children in the stack.
final
hashCode int
The hash code for this object.
no setterinherited
jsonData Map<String, dynamic>?
Raw JSON data for this widget
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
textDirection StacTextDirection?
The text direction used to resolve alignment.
final
type String
Widget type identifier.
no setteroverride

Methods

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

Operators

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