StacFractionallySizedBox class

A Stac widget that sizes its child to a fraction of the available space.

This widget corresponds to Flutter's FractionallySizedBox and sizes its child to a fraction of the total available space.

{@tool snippet} Dart Example:

const StacFractionallySizedBox(
  widthFactor: 0.8,
  heightFactor: 0.6,
  alignment: StacAlignment.center,
  child: StacContainer(color: '#FF0000'),
)

{@end-tool}

{@tool snippet} JSON Example:

{
  "type": "fractionallySizedBox",
  "widthFactor": 0.8,
  "heightFactor": 0.6,
  "alignment": "center",
  "child": {"type": "container", "color": "#FF0000"}
}

{@end-tool}

Inheritance
Available extensions
Annotations
  • @JsonSerializable.new()

Constructors

StacFractionallySizedBox({double? widthFactor, double? heightFactor, StacAlignment? alignment, StacWidget? child})
Creates a fractionally sized box with optional size factors and alignment.
const
StacFractionallySizedBox.fromJson(Map<String, dynamic> json)
Creates a StacFractionallySizedBox from a JSON map.
factory

Properties

alignment → StacAlignment?
How to align the child within the available space.
final
child → StacWidget?
The widget to size fractionally.
final
hashCode → int
The hash code for this object.
no setterinherited
heightFactor → double?
The fraction of the available height to use (0.0 to 1.0).
final
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
widthFactor → double?
The fraction of the available width to use (0.0 to 1.0).
final

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

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