Flutter Textfield delete widgetspan as a whole

69 views Asked by At

I am trying to do mentions in my project. The server will accept a format like @id, for example @15, which means I mentioned user number 15. But in the app, the actual username will be displayed as @Sam,where Sam is the user with id number 15.

What I am doing is to override buildTextSpan function in TextEditingController, converting @15 to a Widget @Sam if an @ symbol is detected.

The question is: when I am doing deleting, flutter actually deletes the chars in TextEditingController one by one. Is there a way to delete @15 in TextEditingController as a whole with only one backspace tap?

0

There are 0 answers