Julius Marozas
09/05/2020, 6:08 PMText
, is there a way to specify the minimum text width in terms of em
?
I have a composable that displays a number and an icon. I want the icon to not move when the amount of digits in the number changes. The maximum amount of digits is 3, so I would like to somehow specify the width of Text
to be 3 em
.Timo Drick
09/05/2020, 7:46 PMJulius Marozas
09/06/2020, 11:36 AMModifier.preferredWidth(3.em.toDp())
(similarly to 10.dp.toPx()
).Vsevolod Ganin
10/31/2020, 4:05 PMwith(DensityAmbient.current) { 3.em.toDp() }
Vsevolod Ganin
10/31/2020, 4:15 PMjava.lang.IllegalStateException: Only Sp can convert to Px
😕Denis
02/10/2021, 6:31 AMConstraints
you need. It's another question how to convert ems to px