StacPositioned class

A Stac widget that controls where a child of a Stack is positioned.

This widget corresponds to Flutter's Positioned widget and allows precise positioning of a widget within a Stack using coordinates and optional sizing constraints.

{@tool snippet} Dart Example:

const StacPositioned(
  left: 10,
  top: 20,
  child: StacText(data: 'Positioned text'),
)

{@end-tool}

{@tool snippet} JSON Example:

{
  "type": "positioned",
  "left": 10,
  "top": 20,
  "child": {"type": "text", "data": "Positioned text"}
}

{@end-tool}

Inheritance
Annotations
  • @JsonSerializable.new()

Constructors

StacPositioned({double? left, double? top, double? right, double? bottom, double? width, double? height, required StacWidget? child})
Creates a positioned widget with optional positioning and sizing.
const
StacPositioned.directional({required StacTextDirection textDirection, double? start, double? top, double? end, double? bottom, double? width, double? height, required StacWidget child})
Creates a widget that controls where a child of a Stack is positioned.
factory
StacPositioned.fill({double? left = 0.0, double? top = 0.0, double? right = 0.0, double? bottom = 0.0, required StacWidget? child})
Creates a StacPositioned object with left, top, right, and bottom set to 0.0 unless a value for them is passed.
const
StacPositioned.fromJson(Map<String, dynamic> json)
Creates a StacPositioned from a JSON map.
factory
StacPositioned.fromRect({required StacRect rect, required StacWidget? child})
Creates a StacPositioned object with the values from the given StacRect.
StacPositioned.fromRelativeRect({required double? left, required double? top, required double? right, required double? bottom, required StacWidget? child})
Creates a StacPositioned object with the values from the given relative rectangle.
const

Properties

bottom → double?
The distance from the bottom edge of the stack.
final
child → StacWidget?
The widget to position within the stack.
final
hashCode → int
The hash code for this object.
no setterinherited
height → double?
The height of the positioned widget.
final
jsonData → Map<String, dynamic>?
Raw JSON data for this widget
finalinherited
left → double?
The distance from the left edge of the stack.
final
The distance from the right edge of the stack.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
top → double?
The distance from the top edge of the stack.
final
type → String
The type of the widget
no setteroverride
width → double?
The width of the positioned widget.
final

Methods

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

Operators

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