Text
Displays a string of text in the terminal.
See also: RichText to style parts of a line differently.
Learn more: Theming
Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.
Text('hello', style: CellStyle(bold: true))Details
Section titled “Details”The text is sanitized (control codes replaced with U+FFFD) before
reaching the cell buffer, so widget code can safely pass arbitrary
or untrusted strings. Grapheme widths are resolved against the
configured CellWidthPolicy.
With softWrap true (default), text exceeding the available width
wraps onto additional rows at word boundaries (or hard-breaks
inside words longer than the width). With softWrap false, automatic
reflow is disabled; explicit newlines still create rows, and each long row
is clipped at the right edge. This is useful for status bars, key hints, or
anywhere overflow is preferable to reflow.
Its own style is merged on top of the ambient DefaultTextStyle, so
a parent can set a base color/dim for a whole subtree once and each
Text overrides only what it sets.
Constructors
Section titled “Constructors”Text()
Section titled “Text()”| Parameter | Type | Default | Description |
|---|---|---|---|
data | String | required | The text to display. Terminal control codes are sanitized before paint. |
style: | CellStyle | CellStyle.none | Style merged over the nearest DefaultTextStyle. |
softWrap: | bool | true | Whether text automatically wraps to additional rows. More |
maxLines: | int? | — | Cap the number of lines; extra content is cut off (and ellipsized when overflow is TextOverflow.ellipsis). |
overflow: | TextOverflow | TextOverflow.clip | How content that exceeds the width/line budget is shown. |
textAlign: | TextAlign | TextAlign.left | Horizontal alignment of each line within the available width. Defaults to TextAlign.left. Use TextAlign.center for centred headings, TextAlign.right for status numbers or right-anchored key hints. |
policy: | TextPresentationPolicy? | — | The text-presentation policy used to measure grapheme clusters. Null (the default) resolves the surface’s ambient policy from MediaQuery — derived at startup from the width probe and FLEURY_* overrides. Pass an explicit policy only to pin measurement against the ambient surface (goldens comparing policies, documentation demos). |
allowSelect: | bool | true | Whether this Text participates in any ancestor SelectionArea’s selection. Defaults to true. Set to false for cosmetic labels that shouldn’t be user-selectable (status indicators, tooltips, hint-bar fragments, etc.) — they’ll still render but the mouse-drag highlight skips over them and Ctrl+A doesn’t pull them into the selection. |
softWrap: When false, explicit newlines still create rows and each long row clips horizontally.
Source
Section titled “Source”Text is defined in packages/fleury/lib/src/widgets/basic.dart.
Category: Text & content · All widgets