StacIntrinsicWidth class

A Stac model representing Flutter's IntrinsicWidth widget.

A widget that sizes its child to the child's maximum intrinsic width.

Analogous to StacIntrinsicHeight but along the horizontal axis. This is useful when child would otherwise be laid out with an unbounded width — for example a column with crossAxisAlignment: stretch inside a horizontally scrolling widget.

This class is relatively expensive, because it adds a speculative layout pass before the final layout phase. Avoid using it where possible.

StacIntrinsicWidth(
  child: StacColumn(
    crossAxisAlignment: StacCrossAxisAlignment.stretch,
    children: [
      StacText(data: 'Short'),
      StacText(data: 'A much longer line of text'),
    ],
  ),
)
{
  "type": "intrinsicWidth",
  "child": {
    "type": "column",
    "crossAxisAlignment": "stretch",
    "children": [
      {"type": "text", "data": "Short"},
      {"type": "text", "data": "A much longer line of text"}
    ]
  }
}
Inheritance
Available extensions
Annotations
  • @JsonSerializable.new()

Constructors

StacIntrinsicWidth({double? stepWidth, double? stepHeight, StacWidget? child})
Creates a StacIntrinsicWidth with the given properties.
const
StacIntrinsicWidth.fromJson(Map<String, dynamic> json)
Creates a StacIntrinsicWidth from JSON.
factory

Properties

child → StacWidget?
The widget below this widget in the tree.
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
stepHeight → double?
If non-null, force the child's height to be a multiple of this value.
final
stepWidth → double?
If non-null, force the child's width to be a multiple of this value.
final
type → String
Widget type identifier.
no setteroverride

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parse(BuildContext context) → Widget?

Available on StacWidget?, provided by the StacWidgetParser extension

parsePreferredSizeWidget(BuildContext context) → PreferredSizeWidget?

Available on StacWidget?, provided by the StacWidgetParser extension

Parses a widget for a slot that needs a PreferredSizeWidget, such as a scaffold's appBar or an app bar's bottom.
toJson() → Map<String, dynamic>
Converts this StacIntrinsicWidth to JSON.
override
toString() → String
A string representation of this object.
inherited

Operators

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