StacText class

A Stac model representing Flutter's Text widget (and Text.rich).

Renders a string of text with optional styling, alignment, direction, and span children.

Dart example:

final widget = StacText(
  data: 'Hello',
  style: StacTheme.textTheme.bodyMedium,
  copyWithStyle: StacTextStyle(color: StacColors.blue),
);

JSON example:

{
  "type": "text",
  "data": "Hello",
  "style": "bodyMedium",
  "copyWithStyle": {"color": "#FF2196F3"}
}

Reference: Flutter Text https://api.flutter.dev/flutter/widgets/Text-class.html

Inheritance
Annotations
  • @JsonSerializable()

Constructors

StacText.new({required String data, List<StacTextSpan>? children, StacTextStyle? style, StacCustomTextStyle? copyWithStyle, StacTextAlign? textAlign, StacTextDirection? textDirection, bool? softWrap, StacTextOverflow? overflow, double? textScaleFactor, int? maxLines, String? semanticsLabel, StacTextWidthBasis? textWidthBasis, StacColor? selectionColor})
Creates a StacText widget.
StacText.fromJson(Map<String, dynamic> json)
Creates a StacText from JSON.
factory

Properties

children List<StacTextSpan>?
Optional inline children as rich TextSpan-like nodes.
final
copyWithStyle StacCustomTextStyle?
Optional style overrides applied on top of style.
final
data String
The text string to display.
final
hashCode int
The hash code for this object.
no setterinherited
jsonData Map<String, dynamic>?
Raw JSON data for this widget
finalinherited
maxLines int?
An optional maximum number of lines for the text to span.
final
overflow StacTextOverflow?
How visual overflow should be handled.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectionColor StacColor?
Color for text selection highlight.
final
semanticsLabel String?
An alternative semantics label for this text.
final
softWrap bool?
Whether the text should break at soft line wraps.
final
style StacTextStyle?
Base text style.
final
textAlign StacTextAlign?
How the text should be aligned horizontally.
final
textDirection StacTextDirection?
The directionality of the text.
final
textScaleFactor double?
The number used to scale text glyphs.
final
textWidthBasis StacTextWidthBasis?
Defines how to measure the width of the text.
final
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 model to JSON.
override
toString() String
A string representation of this object.
inherited

Operators

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