1

I have a situtaion where i need to edit a richtext widget. Im trying to design a compiler in flutter and syntax should be highlighted for it to be userfriendly. The syntax highlighting is working but im not able to edit the richtext. I'm just able to copy paste a code and the syntax is changing styles. I want to be able to edit the Text in RichText

Present Code

RichText(
            textScaleFactor: _baseFontScale,
            text: TextSpan(
              style: TextStyle(fontFamily: 'monospace', fontSize: 12, height: 1.13),
              children: <TextSpan>[
                getSyntax(widget.syntax, widget.syntaxTheme).format(widget.code)
              ],
            ),
          ),

Im currently using stack and placing another textfield in the same place to achieve this but its not going so good. Any help is appreciated.

Sarah Jackson
  • 21
  • 1
  • 1

2 Answers2

0

see this package -- extended_text_field

0

@pskink, You great answer must be an answer here too, not a comment:

It possible to colorize the TextField's content by overriding buildTextSpan method at used TextEditingController: see an example at pskink's answer in related question: https://stackoverflow.com/a/59773962/2064459

Nashev
  • 490
  • 4
  • 10