ClickablePattern constructor

const ClickablePattern({
  1. required String name,
  2. required String pattern,
  3. bool enabled = true,
  4. PatternClicked? onClicked,
  5. TextStyle? style,
  6. InlineSpan spanBuilder(
    1. String text,
    2. ClickablePattern pattern
    )?,
  7. dynamic onSpanCreation(
    1. InlineSpan span,
    2. int index
    )?,
})

Pattern class used by ClickableText widget for pattern finding, and click function bindings.

pattern = regex string to search on text and convert them to different InlineSpan.

name = easy way to tell which pattern is activated.

onClicked = function that is called when InlineSpan is clicked.

style = style for the InlineSpan created.

spanBuilder = for more specific widget building, will not include the onClicked and style attributes, you need to add them yourself.

Implementation

const ClickablePattern({
  required this.name,
  required this.pattern,
  this.enabled = true,
  this.onClicked,
  this.style,
  this.spanBuilder,
  this.onSpanCreation,
});