https://kotlinlang.org logo
#compose
Title
# compose
t

Travis Griggs

09/22/2023, 4:35 PM
I'm trying to deal with the degenerate "longer than expected label/name" field case. I can specify maxLines = 1 and overflow = TextOverflow.Ellipses to some effect. But I was hoping that TextOverflow had options for tightening letter spacing and/or shrinking font to a point before elipsing. iOS has fields for this right in the designer. Is there a technique one can go about to achieve a similiar result? Builtin solutions would be preferrable (to me)
e

ephemient

09/22/2023, 4:47 PM
nothing built-in at the moment and I generally think auto-sizing is a poor solution to the problem too
t

Travis Griggs

09/22/2023, 4:53 PM
what do you think is a better solution then?
i did admit it was the "degenerate case..."
z

Zach Klippenstein (he/him) [MOD]

09/22/2023, 5:03 PM
You could build something using TextMeasurer
e

ephemient

09/22/2023, 5:12 PM
in my team's case, we've simply forced all our designers to take long texts into account
t

Travis Griggs

09/22/2023, 5:18 PM
Given that I allow users to input a name for a given shared asset, and many devices will view that name, from little to big, I'm not sure how I would enforce that or ask designers to cope gracefully with it. What happens, when for grins, someone names one of their irrigation plans by copying in the preamble to the declaration of independence? For grins.
e

ephemient

09/22/2023, 5:19 PM
<marquee>
(just kidding)
in our case we have reasonable name length limitations but still use maxLines=3 when displaying many simple fields such as name
t

Travis Griggs

09/22/2023, 5:21 PM
it's nice to see (looking at that roadmap) that Autosize Text is an "in focus" thing. Not sure what that really means though