In flutter how can we add separate color for a word in a sentence which starts with '@' with separate color when displaying that sentence to UI? Like in Instagram when we mention an user in comment section, the tagged user must be in different color
Asked
Active
Viewed 50 times
0
-
You want to show different color in text field or listview? – Yashraj Jul 23 '22 at 06:38
-
In a sentence a word which starts with "@" must be in separate color. – Dev Prasad Jul 23 '22 at 08:43
1 Answers
0
You can try to use RichText for this case.

MatthiasMRC
- 13
- 5
-
In RichText we are coloring the word which we Knows, here I wants to color the word when I start word with '@" and after that word It must in default color. – Dev Prasad Jul 23 '22 at 08:47
-
Ok I see, so maybe this question will help you : https://stackoverflow.com/questions/68252749/how-can-i-dynamically-change-color-of-certain-words-of-a-paragraph-in-a-text-wid – MatthiasMRC Jul 23 '22 at 08:51
-
What I mean was like in Instagram we mention a user in comment section. – Dev Prasad Jul 23 '22 at 09:01
-
Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 25 '22 at 19:15