StacFlexible class

A Stac model representing Flutter's Flexible widget.

Controls how a child of a Row, Column, or Flex flexes (expands or contracts) to fill the available space along the main axis. Use fit to specify whether the child can be smaller than the space allocated by its flex factor.

{@tool snippet} Dart Example:

StacRow(children: const [
  StacFlexible(flex: 1, child: StacText(data: 'Left')),
  StacFlexible(flex: 2, fit: StacFlexFit.tight, child: StacText(data: 'Right')),
])

{@end-tool}

{@tool snippet} JSON Example:

{
  "type": "row",
  "children": [
    {"type": "flexible", "flex": 1, "child": {"type": "text", "data": "Left"}},
    {"type": "flexible", "flex": 2, "fit": "tight", "child": {"type": "text", "data": "Right"}}
  ]
}

{@end-tool}

Inheritance
Annotations
  • @JsonSerializable()

Constructors

StacFlexible.new({int? flex, StacFlexFit? fit, required StacWidget? child})
Creates a StacFlexible that controls how its child flexes within a Row, Column, or Flex.
const
StacFlexible.fromJson(Map<String, dynamic> json)
Creates a StacFlexible from a JSON map.
factory

Properties

child StacWidget?
The widget controlled by this Flexible.
final
fit StacFlexFit?
How this child is inscribed into the allocated space.
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
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 StacFlexible instance to a JSON map.
override
toString() String
A string representation of this object.
inherited

Operators

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