We got this new thing with `autoSize` for `BasicTe...
# compose
r
We got this new thing with
autoSize
for
BasicText
Copy code
BasicText(
        text = "Hello World",
        maxLines = 1,
        autoSize = TextAutoSize.StepBased()
    )
Is there something like that for
BasicTextField
? It would be nice to scale font in input fields as well
I mean it is possible to do something like
Copy code
onTextLayout = { if (it.hasVisualOverflow) fontSize *= 0.99f }
but besides that?
h
AutoSize is currently only available for
BasicText
. It is a bit ambiguous to define it for
BasicTextField
since it supports scrolling. For now your best option is to use TextMeasurer to do a binary search to find the proper font size. https://gist.github.com/halilozercan/40ec1cc005e0b41e836a7ad21c127dcd https://gist.github.com/halilozercan/d1468efa45c4e9a71907623e41c2ccb7 I have these gists from 3 years ago that may be a bit out of date but they employ the same TextMeasurer idea. You can simply ignore the
AutosizeBasicText
composable.