StacExpanded class
A Stac model representing Flutter's Expanded
widget.
Expands a child of a Row
, Column
, or Flex
so that the child fills
the available space in the main axis, according to the flex factor.
{@tool snippet} Dart Example:
StacRow(children: const [
StacExpanded(child: StacText(data: 'Left')),
StacExpanded(flex: 2, child: StacText(data: 'Right (2x)')),
])
{@end-tool}
{@tool snippet} JSON Example:
{
"type": "row",
"children": [
{"type": "expanded", "child": {"type": "text", "data": "Left"}},
{"type": "expanded", "flex": 2, "child": {"type": "text", "data": "Right (2x)"}}
]
}
{@end-tool}
- Inheritance
-
- Object
- StacElement
- StacWidget
- StacExpanded
- Annotations
-
- @JsonSerializable()
Constructors
- StacExpanded.new({int? flex, StacWidget? child})
-
Creates an expanded widget with optional flex factor and child.
const
-
StacExpanded.fromJson(Map<
String, dynamic> json) -
Creates a StacExpanded from a JSON map.
factory
Properties
- child → StacWidget?
-
The widget that is expanded within its parent
Flex
layout.final - flex → int?
-
The flex factor to use for this child.
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
- type → String
-
The type of the widget
no setteroverride
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