StacSelectableText class

A widget that displays a string of text with a single style.

The string might break across multiple lines or might all be displayed on the same line depending on the layout constraints.

This widget corresponds to Flutter's SelectableText widget.

{@tool snippet} Dart Example:

StacSelectableText(
 data: 'Hello World',
 style: StacTextStyle(fontSize: 20, color: '#FF0000'),
 showCursor: true,
)

{@end-tool}

{@tool snippet} JSON Example:

{
  "type": "selectableText",
  "data": "Hello World",
  "style": {
    "fontSize": 20,
    "color": "#FF0000"
  },
  "showCursor": true
}

{@end-tool}

Inheritance
Annotations
  • @JsonSerializable.new()

Constructors

StacSelectableText({required String data, List<StacTextSpan>? children, StacTextStyle? style, StacCustomTextStyle? copyWithStyle, StacTextAlign? textAlign, StacTextDirection? textDirection, double? textScaler, bool? showCursor, bool? autofocus, int? minLines, int? maxLines, double? cursorWidth, double? cursorHeight, double? cursorRadius, StacColor? cursorColor, bool? enableInteractiveSelection, StacAction? onTap, String? semanticsLabel, StacTextWidthBasis? textWidthBasis, StacColor? selectionColor})
Creates a StacSelectableText.
const
StacSelectableText.fromJson(Map<String, dynamic> json)
Creates a StacSelectableText from a JSON map.
factory

Properties

autofocus bool?
Whether this widget should focus itself if nothing else is already focused.
final
children List<StacTextSpan>?
The list of text spans to display.
final
copyWithStyle StacCustomTextStyle?
The style to merge with the existing style.
final
cursorColor StacColor?
The color of the cursor.
final
cursorHeight double?
The height of the cursor.
final
cursorRadius double?
The radius of the cursor.
final
cursorWidth double?
The thickness of the cursor.
final
data String
The text to display.
final
enableInteractiveSelection bool?
Whether to enable interactive selection.
final
hashCode int
The hash code for this object.
no setterinherited
jsonData Map<String, dynamic>?
Raw JSON data for this widget
finalinherited
maxLines int?
The maximum number of lines to display.
final
minLines int?
The minimum number of lines to occupy when the content spans fewer lines.
final
onTap StacAction?
Called when the user taps on the text.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectionColor StacColor?
The color to use when painting the selection.
final
semanticsLabel String?
An alternative semantics label for the text.
final
showCursor bool?
Whether to show the cursor.
final
style StacTextStyle?
The style to apply to the text.
final
textAlign StacTextAlign?
How the text should be aligned horizontally.
final
textDirection StacTextDirection?
The directionality of the text.
final
textScaler double?
The font scaling strategy to use.
final
textWidthBasis StacTextWidthBasis?
Defines how the paragraph will 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 StacSelectableText instance to a JSON map.
override
toString() String
A string representation of this object.
inherited

Operators

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