SelectiveDefinition constructor

const SelectiveDefinition({
  1. required TextMatcher matcher,
  2. required ShownTextSelector shownText,
  3. Key? rebuildKey,
  4. ActionTextSelector? actionText,
  5. TextStyle? matchStyle,
  6. TextStyle? tapStyle,
  7. TextStyle? hoverStyle,
  8. GestureCallback? onTap,
  9. GestureCallback? onLongPress,
  10. GestureCallback? onGesture,
  11. 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).

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.

Implementation

const SelectiveDefinition({
  required super.matcher,
  required ShownTextSelector super.shownText,
  super.rebuildKey,
  super.actionText,
  super.matchStyle,
  super.tapStyle,
  super.hoverStyle,
  super.onTap,
  super.onLongPress,
  super.onGesture,
  super.mouseCursor,
});