The title may be a bit meaningless, I couldn't think of a better title. I'm sorry. In Flutter, I want to make a TextFormField
like this:
I want to make a customizable TextFormField
. This TextFormField
should have an array field in the form of customTextPatterns. In the array, the key part is the regex pattern, the value part is the way to show the content that matches the pattern.
For example, I want to be able to give the Container
> Text
widget instead of the text corresponding to the ^(0|[1-9][0-9]*)$
pattern (this is the number one regex pattern). Just like in the screenshot. In addition, for example, if the user writes a link, the Container
> Text
widget should be shown again. For example, if the user typed something like this in TextFormField
:
“Hello, is a very nice site!”, the background of the link will be colored and the writing style will be different. Of course, if the user starts deleting, the link should be completely deleted. i.e. if the user hits the delete button at the end of stackoverflow
, the link should be completely deleted along with the Container
.
How can I make such a custom TextFormField
widget? I searched and thought for a long time but unfortunately I couldn't think of a solution.
I am grateful in advance for your support. :)
The title may be a bit meaningless, I couldn't think of a better title. I'm sorry. In Flutter, I want to make a TextFormField
like this:
I want to make a customizable TextFormField
. This TextFormField
should have an array field in the form of customTextPatterns. In the array, the key part is the regex pattern, the value part is the way to show the content that matches the pattern.
For example, I want to be able to give the Container
> Text
widget instead of the text corresponding to the ^(0|[1-9][0-9]*)$
pattern (this is the number one regex pattern). Just like in the screenshot. In addition, for example, if the user writes a link, the Container
> Text
widget should be shown again. For example, if the user typed something like this in TextFormField
:
“Hello, https://stackoverflow is a very nice site!”, the background of the link will be colored and the writing style will be different. Of course, if the user starts deleting, the link should be completely deleted. i.e. if the user hits the delete button at the end of stackoverflow
, the link should be completely deleted along with the Container
.
How can I make such a custom TextFormField
widget? I searched and thought for a long time but unfortunately I couldn't think of a solution.
I am grateful in advance for your support. :)
Share Improve this question edited Mar 12 at 6:39 DarkBee 15.5k8 gold badges72 silver badges118 bronze badges asked Mar 12 at 5:45 Burak ŞanlıBurak Şanlı 351 silver badge4 bronze badges 1- Type "richtext editor" into the pub search. Many possible packages. – Randal Schwartz Commented Mar 12 at 6:01
1 Answer
Reset to default 1Try using rich_editor or flutter_quill package
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744768839a4592630.html
评论列表(0条)