https://kotlinlang.org logo
#compose
Title
# compose
r

raghunandan

07/20/2022, 3:40 AM
Would like to hear from folks has anyone tried tokenizing textfield in compose with @mentions. Would love to hear the approach taken.
z

Zach Klippenstein (he/him) [MOD]

07/20/2022, 5:23 PM
What do you mean by “tokenize”?
r

raghunandan

07/21/2022, 3:54 AM
When user types @ you show list of users in drop down. When user chooses a user it is replaced and made blue just like twitter or fb.
I am interested in how the replacement is done and styling using annotated spans. Do we need visualtransformation or some range or regex??
z

Zach Klippenstein (he/him) [MOD]

07/21/2022, 7:48 PM
I think there's articles or at least other discussions in this slack from people who have actually built this successfully. I'm not sure what the best approach is, but one thing you could do is use a FlowRow from accompanist and insert all your tokens before the field
r

raghunandan

07/22/2022, 4:46 AM
Thanks!. In case you find articles can you link it here?.
5 Views