Is there a way to apply a VisualTransformation or ...
# compose-android
j
Is there a way to apply a VisualTransformation or something similar to BTF2 at this point?
s
j
I've been using a visualTransformation with the original BTF, but I don't know how to apply it to BTF2. The original BTF takes it as a parameter, and I used it both there and on the decoration box. BTF2 doesn't have that parameter, but I still used it on the decoration box, but it doesn't show it.
s
j
I'm not positive, but it looks like the decoration box just uses it to compute a state (it's just an enum), so I guess displaying the result in orig BTF happens from its visualtransform parameter
s
Maybe take a step back here, what is it that you are trying to achieve in the first place?
j
InputTransform happens between user input and saving the field's value. I'm only trying to transform the visual output
basically adding a units superscript label to the main value displayed
I'll show you what it looks like on btf1, maybe i'm overthinking
s
Aha, so something like this https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/[…]rmation.allCaps&ss=androidx%2Fplatform%2Fframeworks%2Fsupport doesn’t just change the visuals, but translates the value you get out of it too then you say?
j
2023-09-20 03_36_05-.png
yeah, the state i care about tracking is the Double
s
I’ve seen this the other day https://x.com/halilozercan/status/1700187684474438093 which makes me think there must be a way to edit the output UI without editing the text field state itself, but I haven’t played enough with BTF2 myself to know how it’s done 👀
👍 1
j
I think that's the codepointsTransform. it changes each character 1:1, so perf form hiding passwords
BTF2 seems great so far, but maybe the last step of changing the visual output isn't built in yet. You were probably right that I'll have to work out my own thing for now
thanks for looking!
a
It's not yet available but is planned. Zach talked about this

here

(starting from 12700).
👍 2
thank you color 2
j
awesome! thank you
z
I just talked about this at droidcon NYC! We’re working on a new API for this: https://speakerdeck.com/zachklipp/reimagining-text-fields-in-compose-dcnyc-23?slide=44
It’s not out yet, you might not be surprised to hear it’s quite complicated to implement 😅
👍 2
I literally have the branch open right now working on it
🦜 3
🙏🏾 1
j
awesome! I'm a huge fan so far. Especially how it keeps outside updates separate during editing. To me, that solves a lot of tricky problems with keeping the data in sync, but also the cursor where the user expects it.
Can't wait for it to be the norm!