SpanBuilder class

given some plain text, e.g.: "The quick brown fox" allows you to apply multiple spans at multiple positions. Positions can be specified by word, that is e.g. "brown" or range (from=10, to=15) and spans are subclasses of InlineSpan Once you are done using SpanBuilder, use build to return calculated list of spans. The rest of the text, that has no span either inherits TextStyle from parent span or can be forced to use defaultStyle

USAGE:

final spans = SpanBuilder("The quick brown fox")
  .apply(TextSpan(text: "brown", style: TextStyle(fontWeight: FontWeight.bold)))
  .apply(TextSpan(text: "🦊"), whereText: "fox")
  .build()

Constructors

SpanBuilder(String sourceText)

Properties

hashCode int
The hash code for this object.
read-onlyinherited
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
sourceText String
final

Methods

add(SpanEntity newEntity) SpanBuilder
we sort entities when we add them, if any of the entities is overlapping, we throw StateError
apply(InlineSpan span, {String whereText, int from, int to, dynamic onTap(), RecognizerBuilder recognizerBuilder}) SpanBuilder
build({_RecognizerBuilder recognizerBuilder}) List<InlineSpan>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited