I’m making a Flutter UI for a grammar checking tool.
I know we could use RichText to make text that has whatever style we want and can be clicked. I also know how to set textStyles and use GestureDetector.
However, the user needs to the ability to freely edit the text as a normal text input.
How can we do this in Flutter? Any widgets to the rescue?
2
Answers
a) For underline you can use a property of TextStyle. Example:
b) For make clickable, I think you have to use GestureDetector() apli.flutter.dev
You can do this by extending TextEditingController and override buildTextSpan method with your own logic to add underline under specific words. One way is to use regex. Here is an example.
import ‘package:flutter/material.dart’;
Once this is done, use your newly created Controller instead of TextEditingController with TextFeild.