buildTextSpan method
TextSpan
buildTextSpan({
- required BuildContext context,
- TextStyle? style,
- required bool withComposing,
override
Builds TextSpan from current editing value.
By default makes text in composing range appear as underlined. Descendants can override this method to customize appearance of text.
Implementation
@override
TextSpan buildTextSpan({
required BuildContext context,
TextStyle? style,
required bool withComposing,
}) {
if (_parser == null) {
_init();
}
return _textSpanNotifier.elements.isEmpty
? TextSpan(
text: _textSpanNotifier.value.text,
style: style,
)
: TextSpan(
children: _textSpanNotifier.value.children,
// The style from buildTextSpan() must be applied to the
// top level. Applying it to the children instead causes
// the following behaviours.
//
// * The height is not applied to the cursor.
// * Changes in the style specified in editable text are
// not reflected quickly.
style: style,
);
}