flutter - How to put text in a square in TextFormField? - Stack Overflow

The title may be a bit meaningless, I couldn't think of a better title. I'm sorry. In Flutter

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
Add a comment  | 

1 Answer 1

Reset to default 1

Try using rich_editor or flutter_quill package

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744768839a4592630.html

相关推荐

  • flutter - How to put text in a square in TextFormField? - Stack Overflow

    The title may be a bit meaningless, I couldn't think of a better title. I'm sorry. In Flutter

    10天前
    60

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信