buildTextSpan method

TextSpan buildTextSpan (
  1. {TextStyle style,
  2. bool withComposing}

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.


TextSpan buildTextSpan({TextStyle style , bool withComposing}) {
  if (!value.composing.isValid || !withComposing) {
    return TextSpan(style: style, text: text);
  final TextStyle composingStyle = style.merge(
    const TextStyle(decoration: TextDecoration.underline),
  return TextSpan(
    style: style,
    children: <TextSpan>[
      TextSpan(text: value.composing.textBefore(value.text)),
        style: composingStyle,
        text: value.composing.textInside(value.text),
      TextSpan(text: value.composing.textAfter(value.text)),