How can I update TextSpan in Flutter? - flutter

I need to show a block of code along with error in flutter.
I'm using flutter_highlight library to get highlighted code TextSpan.
Next I want to underline the errors in code, I'm able to add underline to basetext easily but. I need these text span to be combined somehow?
How can I achieve this?
I tried going through the docs, but there is no mention of such thing.

Related

How to add color text in textform flutter?

I want to make a text form like this, how do I add color to certain text via regex?
Please check flutter this sample code,
https://flutter.github.io/samples/rich_text_editor.html

need to change colour of a selected word in a paragraph in flutter

Exactly like the attached Image i need to select a word from the paragraph and highlight the particular word.
We tried using rich text but id doesn’t meet our requirement(we need to select a word and highlight it) so we need a alternate way to achieve this using flutter
Use RichText. Text widget uses it internally. You can provide list of TextSpan with different styles.

Write ahead in flutter textfield

Is there an efficient way to implement the next line completion in flutter textfield ?
The image shows the final result, the grey text is human written and the red is app generated which can be either appended to the editable on textfield or canceled.
You may add some prediction words after user's input and still keep the cursor on his/her last entered character using TextInputFormatter. Flutter already has built-in formatters like FilteringTextInputFormatter.
Just switch to text when you want to show the prediction, there is no other way to do this in flutter.
You simply cannot show other text and options on textfield in flutter

Styling certain words inside an EditableText

I'm new to flutter and I need an editor that can format certain words (e.g., automatic URL detection and formatting it to blue inside the editor). So far, I have not found a plugin for that so I decided to write my own plugin.
The question here is: where do I start?
I've tried using a Rich.text() with TextSpan as children but I can't edit those children. I've tried using a SizedBox with inside of it an EditableText but I encountered 2 problems.
The fontSize of EditableText always differs from the fontSize of a TextSpan, no matter if I apply the same TextStyle (this really frustrates me)
The whole Rich.text() doesn't work as a single editor, which is what I'm trying to achieve.
Could someone point me into the right direction? Thanks in advance!

Why is customizing paragraphs in flutter a pain?

I have been struggling with this for a couple of days. I want to display a few university lessons in a flutter app. I used the Text widget, but it's not sufficiently customizable. If I want to make one single word bold in the entire paragraph, I can't do that. I tried the RichText widget, but that was a pain in the neck, I would have to create a new TextSpan everytime I want to customize a piece of the paragraph somehow.
Before you say markdown, I gave that a try too. But I can't change the font size, it's small and not so easy on the eyes. I did check the docs on Github, but there doesn't seem to be enough flexibility, you can't resize or align text.
I am left with one option, which is to use an HTML view plugin. I tried importing that, but now it's giving me an error.
If you know any tricks on how to customize text, hopefully within flutter, not using HTML/markdown, I would really appreciate it. Any suggestions on how to make my life easier are welcome!