SpanDefinition class
A class that defines parsing rules, appearance and actions, and builds the InlineSpan to replace matched strings with.
An object of InlineSpan or its subtype (e.g. WidgetSpan) returned from the builder function is displayed in place of the string matched by the match pattern specified in this definition.
When this definition type is used, the InlineSpan created by builder is not shown until CustomText finds which parts in the original text need to be replaced with the span, so that the raw text is not shown as is while waiting. Exceptionally, this behaviour is not applied if CustomText.preventBlocking is enabled.
See also the document of TextDefinition, which has most of other properties in common.
- Inheritance
-
- Object
- Definition
- SpanDefinition
Constructors
- SpanDefinition({required TextMatcher matcher, required SpanBuilder builder, Key? rebuildKey, TextStyle? matchStyle, TextStyle? tapStyle, TextStyle? hoverStyle, GestureCallback? onTap, GestureCallback? onLongPress, GestureCallback? onGesture, MouseCursor? mouseCursor})
-
Creates a SpanDefinition that defines parsing rules,
appearance and actions, and builds the InlineSpan to replace
certain portions of text with.
const
Properties
- actionText → ActionTextSelector?
-
The function to choose a string to be passed to gesture callbacks.
finalinherited
- builder → SpanBuilder
-
The builder function that builds an InlineSpan to replace
matched strings with.
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- hoverStyle → TextStyle?
-
The text style used for matched strings while they are under
the mouse pointer.
finalinherited
- isTextDefinition → bool
-
Whether the definition is TextDefinition.
no setterinherited
- matcher → TextMatcher
-
The matcher used to parse text for this definition.
finalinherited
- matchStyle → TextStyle?
-
The text style for matched strings.
finalinherited
- mouseCursor → MouseCursor?
-
The mouse cursor shown on a matched string while it is being hovered.
finalinherited
- onGesture → GestureCallback?
-
The callback function called when a gesture happens on a matched string.
finalinherited
- onLongPress → GestureCallback?
-
The callback function called when a matched string is long-pressed.
finalinherited
- onTap → GestureCallback?
-
The callback function called when a matched string is tapped.
finalinherited
- rebuildKey → Key?
-
A key that is used to decide whether to rebuild the InlineSpans
relevant to this definition.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- shownText → ShownTextSelector?
-
The function to choose a string to be shown.
finalinherited
- tapStyle → TextStyle?
-
The text style used for matched strings while they are being pressed.
finalinherited
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