StacFittedBox class
A Stac widget that scales and positions its child within itself.
This widget corresponds to Flutter's FittedBox and scales its child to fit within the available space according to the specified fit and alignment.
{@tool snippet} Dart Example:
const StacFittedBox(
fit: StacBoxFit.contain,
alignment: StacAlignment.center,
child: StacText(data: 'Fitted content'),
)
{@end-tool}
{@tool snippet} JSON Example:
{
"type": "fittedBox",
"fit": "contain",
"alignment": "center",
"child": {"type": "text", "data": "Fitted content"}
}
{@end-tool}
- Inheritance
-
- Object
- StacElement
- StacWidget
- StacFittedBox
- Annotations
-
- @JsonSerializable()
Constructors
- StacFittedBox.new({StacBoxFit? fit, StacAlignment? alignment, StacClip? clipBehavior, StacWidget? child})
-
Creates a StacFittedBox that scales and positions its
child
.const -
StacFittedBox.fromJson(Map<
String, dynamic> json) -
Creates a StacFittedBox from a JSON map.
factory
Properties
- alignment → StacAlignment?
-
How to align the child within the box.
final
- child → StacWidget?
-
The widget to scale and position.
final
- clipBehavior → StacClip?
-
How to clip the child if it overflows.
final
- fit → StacBoxFit?
-
How the child should be scaled to fit within the 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
-
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 StacFittedBox instance to a JSON map.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited