Reputation: 1473
I need to implement visual transformation in Text but somehow Text doesn't have this parameter only TextFiled does have this parameter. How to find solution about this?
Example;
TextField(
visualTransformation = // have this parameter
)
Text(
visualTransformation = // doesnt have this parameter
)
I need that because i have to show big decimal contains comma and dot seperator and i have visual transformation of this.
Upvotes: 6
Views: 2559
Reputation: 1945
You can use your custom VisualTransformation
class to transform your text before passing it to Text
.
val visualTransformation = remember { CustomVisualTransformation() }
val transformedText = remember(value) {
visualTransformation.filter(AnnotatedString(value))
}.text
Text(text = transformedText)
Upvotes: 11