Span class final
Text in one Style, what styled text is made of, its text colors along a Gradient when it has one (Span.gradient). Made from a string by StringStyles; each of its members returns the span with its style merged with one more field, a kind of underline replacing the one there was, its gradient kept.
A line of styled text for Text.rich:
Text.rich([
'Error: '.bold.fg(Color.red),
const Span('file not found'),
])
- Annotations
-
- @immutable
Constructors
- Span(String text, [Style? style])
-
textinstyle, unset by default or where null, so that a style that depends goes in as it is:Span(text, overdue ? theme.warning : null).const - Span.gradient(String text, Gradient gradient, [Style? style])
-
textinstyle(unset where null), its text colors alonggradient.const
Properties
- bold → Span
-
This span in bold.
no setter
- curlyUnderline → Span
-
This span underlined with a curly line.
no setter
- dashedUnderline → Span
-
This span underlined with a dashed line.
no setter
- dim → Span
-
This span dimmed.
no setter
- dottedUnderline → Span
-
This span underlined with a dotted line.
no setter
- doubleUnderline → Span
-
This span underlined with a double line.
no setter
- gradient → Gradient?
-
The text colors along the graphemes of text, in place of the text
color of style and its opacity: the first grapheme in the color at
0, the last in that at 1, whatever lines they are on; a control that
takes no cell, such as a line break, is not one. The gradient's
direction does not matter. Null for the text color of style.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- italic → Span
-
This span in italics.
no setter
- onTap → VoidCallback?
-
Called when text is clicked in a Text with this span: the left
button pressed and released on the same cell of it. Null, the
default, for none; set by tap. The span's text is not written as a
hyperlink, as it is with link and
Text.onLinkTap: for a click on a phrase that is not a URL. A Text that has such a span asks the terminal to report the mouse's buttons.final - overline → Span
-
This span with a line over it.
no setter
- reverse → Span
-
This span in reverse video: its text color and background swapped.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- strike → Span
-
This span struck through.
no setter
- style → Style
-
How text looks; merged, where it is shown, onto the style there
(DefaultTextStyle).
final
- text → String
-
What is shown.
final
- underline → Span
-
This span underlined with a single line.
no setter
Methods
-
bg(
Color color) → Span -
This span on the background
color, opaque. -
fg(
Color color) → Span -
This span in the text color
color, opaque. -
link(
String url) → Span -
This span as a hyperlink to
url(OSC 8). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
tap(
VoidCallback onTap) → Span -
This span calling
onTapwhen it is clicked (Span.onTap), in place of the call it had. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
Whether
otheris a span of an equal text, style and gradient, and the same onTap.override