StacAspectRatio class
A Stac model representing Flutter's AspectRatio
widget.
Constrains its child to a specific width-to-height ratio.
{@tool snippet} Dart Example:
StacAspectRatio(
aspectRatio: 16 / 9,
child: StacContainer(color: '#FF0000'),
)
{@end-tool}
{@tool snippet} JSON Example:
{
"type": "aspectRatio",
"aspectRatio": 1.7778,
"child": {"type": "container", "color": "#FF0000"}
}
{@end-tool}
- Inheritance
-
- Object
- StacElement
- StacWidget
- StacAspectRatio
- Annotations
-
- @JsonSerializable()
Constructors
- StacAspectRatio.new({required double aspectRatio, required StacWidget? child})
-
Creates an aspect ratio widget with the specified ratio and child.
const
-
StacAspectRatio.fromJson(Map<
String, dynamic> json) -
Creates a StacAspectRatio from a JSON map.
factory
Properties
- aspectRatio → double
-
The width-to-height ratio to honor for laying out the child.
final
- child → StacWidget?
-
The widget to display inside the constrained aspect ratio box.
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