Hi! Are there any plans to add a `contentPadding` ...
# compose
s
Hi! Are there any plans to add a
contentPadding
parameter to
BasicTextField
in Compose 1.8? I've filed an issue here a while ago: https://issuetracker.google.com/issues/302599627
@Halil Ozercan 👀
d
I guess you just use the decoration box for that
s
The issue itself mentions why the decoration box isn't enough, as there's clipping when scrolling the text field itself internally.
d
Ah alright
s
Yeah, and adding a
scrollable
modifier inside the decoration box gives the text field infinite height, which: 1. Forces the whole text field to get rendered, foregoing any current (or upcoming) optimizations. 2. Makes the
scrollState
parameter of the text field effectively useless, always staying at
0
.
And it probably needs some extra focus/bring into view handling with `BringIntoViewRequester`/`BringIntoViewResponder` (though I'm not super sure about that).
h
Yep, please don't add a
scrollable
modifier in decorator, the behavior is undefined. We are committed to addressing this concern since it's a shortcoming of the decoration API. I'm afraid it won't be in
1.8
though.
s
That's pretty sad 😞 Is that talking about the decorator API in general, or just
contentPadding
? As an aside, one other blocker to using the new fields is
AnnotatedString
support, are those being worked on for 1.8 or delayed for a later release?
As for using `scrollable`/`verticalScroll`, it's currently what I use in production (I have it on the text field itself, not decorator, but the same limitations apply). Have to use
BringIntoViewRequester
alongside the results of
onTextLayout
and
TextFieldValue.selection
to keep the cursor on screen, but it's not very complicated, and aside from potential performance issues, it works pretty well, on both the new and old text fields (I still use the old text fields when I need
AnnotatedString
).