Skip to content

RichText

Renders a TextSpan tree: multiple styles on a line, with the same wrapping, maxLines, and overflow behavior as Text. The ambient DefaultTextStyle is the base the root span merges onto.

See also: Text when one style covers the whole string.

Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.

RichText(text: TextSpan(children: [
TextSpan(text: 'deploy '),
TextSpan(text: 'ok', style: CellStyle(bold: true)),
]))

Participates in app-wide text selection: drag, double-click, and Shift+Arrow work across mixed Text and RichText widgets inside a SelectionArea. The selected copy is the plain text of the spans — styles are visual only, never round-tripped to the clipboard. Set allowSelect: false to mask a particular RichText off from any ambient SelectionArea.

ParameterTypeDefaultDescription
text:TextSpanrequiredRoot of the styled span tree to render.
softWrap:booltrueWhether content wraps to additional rows at the available width.
maxLines:int?—Maximum rendered rows, or null for no explicit line limit.
overflow:TextOverflowTextOverflow.clipHow content beyond the width or maxLines budget is represented.
allowSelect:booltrueWhether this RichText participates in ambient SelectionArea selection. When false, the widget is invisible to selection: drags pass over without highlight, Ctrl+A skips the content. Defaults to true.

RichText is defined in packages/fleury/lib/src/widgets/rich_text.dart.

Category: Text & content · All widgets