mattinger
03/26/2025, 2:23 PMZach Klippenstein (he/him) [MOD]
03/26/2025, 2:30 PMmattinger
03/26/2025, 2:52 PMprivate fun measureTextWidth(text: String, style: TextStyle): Dp {
val textMeasurer = rememberTextMeasurer()
val widthInPixels = textMeasurer.measure(text = text, style = style).size.width
return with(LocalDensity.current) { widthInPixels.toDp() }
}
If i manually set the size of the Text element to 1 dp larger than this, the button is fine in all viewings.
val measured = measureTextWidth(
text = stringResource(id = R.string.apply_button_label),
style = LocalTextStyle.current
)
Text(
modifier= Modifier.width(measured.plus(1.dp)),
If i don't add that extra dp, it's always wrapping.Grant Toepfer
03/26/2025, 4:40 PMGrant Toepfer
03/26/2025, 4:42 PM1.8-rc01
mattinger
03/26/2025, 7:15 PMmattinger
03/27/2025, 2:52 PM