StacCenter class

A Stac model representing Flutter's Center widget.

Centers its child within itself, optionally expanding based on widthFactor and heightFactor.

{@tool snippet} Dart Example:

StacCenter(
  child: StacText(data: 'Hello world'),
)

{@end-tool}

{@tool snippet} JSON Example:

{
  "type": "center",
  "child": {"type": "text", "data": "Hello world"}
}

{@end-tool}

Inheritance
Annotations
  • @JsonSerializable()

Constructors

StacCenter.new({double? widthFactor, double? heightFactor, StacWidget? child})
Creates a center widget with optional sizing factors and child.
const
StacCenter.fromJson(Map<String, dynamic> json)
Creates a StacCenter from a JSON map.
factory

Properties

child StacWidget?
The widget to be centered.
final
hashCode int
The hash code for this object.
no setterinherited
heightFactor double?
The height factor to expand to based on the child's height.
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 width factor to expand to based on the child's width.
final

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