I'm half tempted to make a copy of it just to give...
# compose
a
I'm half tempted to make a copy of it just to give it scroll state
s
You can wrap the inner text field in a
Box
with
Modifier.horizontalScroll
, and then expose that scroll state.
a
Then you have two scrollables to deal with... It's better this gets fixed at a platform level
s
I do this on regular text fields for other reasons (content padding), and it leaves me a tiny tweeny bit worried about any potential performance hits (scroll containers can inhibit any internal lazy rendering the text field may be doing, as they force rendering everything), but it seems to be fine overall, I got apps in production with it. Passwords are tiny, often single-line, so it's not an issue there at all.
a
especially because the implementation is shared between both BasicTextField and SecureBasicTextField
If it's the only way for now, I'll opt to do that
But, otherwise, if it exists in the platform, and just needs to be exposed, that's the better long term solution
s
@andrew The
horizontalScroll
(or any other scroll container) will give the text infinite max width, so the inner scrolling of the text field will be basically non-existent, so it'll all feel as though there's one scroll container which is yours.
but yeah, i agree, that's definitely an overlook by the Compose team The two APIs should be largely identical unless it's really needed.
a
I realize that, yes. I'm just thinking because I already use the scrollstate of the inner text field from basic text field
Short term, I'll probably do this even if it's a little hacky ๐Ÿ˜‚
1000014301.mp4
s
I'm in the same camp now because of lack of
contentPadding
, I have to do this hack :p
a
The edge treatment looks much better than the harsh clipping
This was my solution to compensate for that haha
The lack of contentPadding
s
yeeep, that's exactly why I use it, I hate the clipping ๐Ÿ˜†
a
I'll just have to make sure I deal with orientation appropriately and live with it for now, until it's triaged and fixed
s
I actually have it full-screen, so a fade could work, but the optimal thing is to have the text scroll under the navigation and status bars (like lazy lists)
๐Ÿ‘๐Ÿป 1
a
That's fair
Because I'm so detail oriented, I often think of things the designers don't, purely because I have a knack for design and development, so the little extra things like this I will stress over
same 1
Definitely will have to think about how to handle multiline, effectively
s
Shouldn't be too hard, you'll have to switch to
verticalScroll
though
a
It'll think it's constrained to infinity
s
I'm not familiar with use-cases for multiline secure text fields (PGP keys maybe?), but it should be doable
a
I just have to be mindful of where it's being passed into which modifier (whether the BasicTextField is handling it or not)
I got it working, it's just less than ideal, but it works
๐Ÿ‘ 1
Although it broke a few other things. I'll have to keep tinkering
s
I have it working with a multiline text field (for content padding), works pretty well overall
you may have issues with the cursor going out of view though
a
In my case I need to wrap the box containing the content + modifier in another box
For the faded edge treatment
s
ahh i see since it's BasicSecureTextField (the basic variant), I think you can apply that from the outside? like, without using the decorator
a
I'm keeping it within the decorator since it handles the layout of other things
I also need to turn off the elastic overscroll as well
s
oh wait you don't actually have to do that
You could extract this whole thing into its own Composable (like a fork of the original) that also exposes scrollState Then for the decorator, you just call the passed-in decorator parameter inside your decorator (confusing sentence :p) and do all the scroll handling in there this way you won't have to change anything about how you use it
a
It'd probably be easier to understand what's happening here if you had the code in front of you lol
s
I can actually send some code, but it's tailored for vertical scroll I'll make it handle horizontal and send it over
a
I have vertical scroll working fine
I just got a clean up horizontal
๐Ÿ‘ 1
Since it stretches with the default overscroll effect
Okie dokie, it's fixed now
Screenshot_20250204-210948.png
screen-20250204-211034.mp4
๐Ÿ™Œ 1