SelectiveDefinition class
A class that defines parsing rules, appearance and actions, and flexibly selects the string to be shown and another string to be passed to callbacks (e.g. onTap, onGesture).
shownText and actionText are functions to select a string. The string returned by shownText is displayed, and the string returned by actionText is included in the GestureDetails object passed to onTap, onLongPress and onGesture.
When this definition type is used, the text selected by shownText is not shown until parsing completes and spots which parts in the original text need to be replaced with the selected text, 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
- SelectiveDefinition
Constructors
- SelectiveDefinition({required TextMatcher matcher, required ShownTextSelector shownText, Key? rebuildKey, ActionTextSelector? actionText, TextStyle? matchStyle, TextStyle? tapStyle, TextStyle? hoverStyle, GestureCallback? onTap, GestureCallback? onLongPress, GestureCallback? onGesture, MouseCursor? mouseCursor})
-
Creates a SelectiveDefinition that defines parsing rules,
appearance and actions, and flexibly selects the string to
be shown and another string to be passed to callbacks (e.g.
onTap, onGesture).
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