toTextSpan method
TextSpan
toTextSpan({
- TextStyle? style,
- TextStyle regularTextStyle = const TextStyle(fontWeight: FontWeight.normal),
- TextStyle highlightedTextStyle = const TextStyle(fontWeight: FontWeight.bold),
- GestureRecognizer? recognizer,
- MouseCursor? mouseCursor,
- PointerEnterEventListener? onEnter,
- PointerExitEventListener? onExit,
- String? semanticsLabel,
- Locale? locale,
- bool? spellOut,
Converts HighlightedString to TextSpan.
Applies regularTextStyle
and highlightedTextStyle
styles to
to non-highlighted and highlighted sub-spans accordingly.
Example
Text.rich(
hit.getHighlightedString('title').toTextSpan(),
);
Implementation
TextSpan toTextSpan({
TextStyle? style,
TextStyle regularTextStyle = const TextStyle(fontWeight: FontWeight.normal),
TextStyle highlightedTextStyle =
const TextStyle(fontWeight: FontWeight.bold),
GestureRecognizer? recognizer,
MouseCursor? mouseCursor,
PointerEnterEventListener? onEnter,
PointerExitEventListener? onExit,
String? semanticsLabel,
Locale? locale,
bool? spellOut,
}) =>
TextSpan(
style: style,
children: toInlineSpans(
regularTextStyle: regularTextStyle,
highlightedTextStyle: highlightedTextStyle,
),
recognizer: recognizer,
mouseCursor: mouseCursor,
onEnter: onEnter,
onExit: onExit,
semanticsLabel: semanticsLabel,
locale: locale,
spellOut: spellOut,
);