Text class

A run of text with a single style, rendered through the terminal text pipeline.

Supported styling is the terminal-representable subset of TextStyle: foreground/background Color, FontWeight normal/bold/dim, FontStyle italic, underline and line-through TextDecoration, and the terminal-specific blink/reverse TextEffects. TextAlign supports left, center, and right.

Flutter compatibility note: fontSize, fontFamily, letterSpacing, wordSpacing, height, FontWeight.w100-w900, TextAlign.justify, and TextDecoration.overline are removed — the fixed character grid and terminal-controlled font cannot express them.

Inheritance

Constructors

Text(String? data, {TextStyle? style, TextAlign textAlign = TextAlign.left, int? maxLines, bool softWrap = true, TextOverflow overflow = TextOverflow.clip, TextHighlight? selection, Key? key})
Creates a Text widget.
const
Text.rich(TextSpan textSpan, {TextStyle? style, TextAlign textAlign = TextAlign.left, int? maxLines, bool softWrap = true, TextOverflow overflow = TextOverflow.clip, TextHighlight? selection, Key? key})
Creates text from an inline span tree.
const

Properties

data → String?
The text to display.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how this widget replaces another of the same type.
finalinherited
maxLines → int?
The maximum number of lines to display.
final
overflow → TextOverflow
How to handle visual overflow.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selection → TextHighlight?
Optional text selection highlight configuration.
final
softWrap → bool
Whether to break lines softly at word boundaries.
final
style → TextStyle?
The style to use for this text.
final
textAlign → TextAlign
How the text should be aligned horizontally within its bounds.
final
textSpan → TextSpan?
Rich text span to display.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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