TextDefinition constructor

const TextDefinition({
  1. required TextMatcher matcher,
  2. TextStyle? matchStyle,
  3. TextStyle? tapStyle,
  4. TextStyle? hoverStyle,
  5. void onTap(
    1. GestureDetails
    )?,
  6. void onLongPress(
    1. GestureDetails
    )?,
  7. void onGesture(
    1. GestureDetails
    )?,
  8. MouseCursor? mouseCursor,
})

Creates a TextDefinition that defines rules for parsing, appearance and actions for CustomText and CustomTextEditingController.

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. 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.

Implementation

const TextDefinition({
  required super.matcher,
  super.matchStyle,
  super.tapStyle,
  super.hoverStyle,
  super.onTap,
  super.onLongPress,
  super.onGesture,
  super.mouseCursor,
});