TextDefinition class
A class that defines parsing rules, appearance and actions for CustomText, CustomTextEditingController and CustomSpanBuilder.
The strings that have matched the pattern defined in matcher are styled according to matchStyle, tapStyle and hoverStyle while not pressed, being pressed, and being hovered, respectively.
onTap and onLongPress are handler functions called when a TextSpan is tapped and long-pressed. onGesture is a handler function called when other gesture events happen. A GestureDetails object containing details on the element and the event (kind, text, tap position, etc) is passed in to the functions.
mouseCursor is a mouse cursor type used while the mouse hovers over a matching text element. Note that even if this is omitted, SystemMouseCursors.click is automatically used if onTap or onLongPress is specified.
Also note that most properties are ignored in CustomSpanBuilder. See its document for details.
- Inheritance
-
- Object
- Definition
- TextDefinition
Constructors
- TextDefinition({required TextMatcher matcher, Key? rebuildKey, TextStyle? matchStyle, TextStyle? tapStyle, TextStyle? hoverStyle, GestureCallback? onTap, GestureCallback? onLongPress, GestureCallback? onGesture, MouseCursor? mouseCursor})
-
Creates a TextDefinition that defines rules for parsing, appearance
and actions for CustomText, CustomTextEditingController and
CustomSpanBuilder.
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.
finalinherited
- 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