SelectiveDefinition constructor

const SelectiveDefinition(
  1. {required TextMatcher matcher,
  2. required ShownTextSelector shownText,
  3. ActionTextSelector? actionText,
  4. TextStyle? matchStyle,
  5. TextStyle? tapStyle,
  6. TextStyle? hoverStyle,
  7. GestureCallback? onTap,
  8. GestureCallback? onLongPress,
  9. GestureCallback? onGesture,
  10. MouseCursor? mouseCursor}

Creates a SelectiveDefinition that defines rules for parsing, appearance and actions similarly to TextDefinition but allows a little more flexible settings.

The strings that have matched the pattern defined in matcher are styled according to the styles specified by matchStyle, tapStyle and hoverStyle, which are applied to a TextSpan while it is not pressed, being pressed, and being hovered, respectively.

onTap and onLongPress are handler functions called when a TextSpan is tapped and long-pressed respectively. onGesture is a handler function called when other gesture events happen.

shownText and actionText are functions for selecting a string. It receives a list of strings that have matched the fragments enclosed in parentheses within the match pattern. The string returned by shownText is displayed, and the one returned by actionText is included in the GestureDetails object passed to onTap, onLongPress and onGesture.

mouseCursor is a mouse cursor type used while the mouse hovers over a matching text element. Note that even if this is omitted, is automatically used if onTap or onLongPress is specified.


const SelectiveDefinition({
  required super.matcher,
  required ShownTextSelector super.shownText,