I use intl package to internationalize my app, but a problem comes to me.
There is a string for English and Chinese:
"has $num"
"有$num个"
Now I want to add some style to the $num
part, e.g., set the number to red color.
I thought I need to get the string by locale, process and split the string then convert it to TextSpans by myself.
Is there any easier/cleverer way to do this?
Well actually you can use inline html view from webview_flutter
(ref https://github.com/flutter/flutter/issues/19030#issuecomment-437534853 )
"has <span style='text-color:red'>$num</span>"
"有<span style='text-color:red'>$num</span>个"
Just have to be careful with string interpolation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With