SpanDefinition constructor

const SpanDefinition({
  1. required TextMatcher matcher,
  2. required SpanBuilder builder,
  3. Key? rebuildKey,
  4. TextStyle? matchStyle,
  5. TextStyle? tapStyle,
  6. TextStyle? hoverStyle,
  7. GestureCallback? onTap,
  8. GestureCallback? onLongPress,
  9. GestureCallback? onGesture,
  10. MouseCursor? mouseCursor,
})

Creates a SpanDefinition that defines parsing rules, appearance and actions, and builds the InlineSpan to replace certain portions of text with.

An object of InlineSpan or its subtype (e.g. WidgetSpan) returned from the builder function is displayed in place of the string matched by the match pattern specified in this definition.

When this definition type is used, the InlineSpan created by builder is not shown until CustomText finds which parts in the original text need to be replaced with the span, 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 SpanDefinition({
  required super.matcher,
  required SpanBuilder super.builder,
  super.rebuildKey,
  super.matchStyle,
  super.tapStyle,
  super.hoverStyle,
  super.onTap,
  super.onLongPress,
  super.onGesture,
  super.mouseCursor,
});