I need to add text element next to checkbox, but unfortunately without wrapping in actual layout it looks too ugly due to available width. Is there a way to make text wrap around checkbox? The only solution I can think of is splitting text by spaces and putting it into FlowRow which doesn’t sound like a right way to do this.
@OptIn(ExperimentalLayoutApi::class)
@Preview
@Composable
fun TickedItems(modifier: Modifier = Modifier, text: String = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec scelerisque urna nulla, vel venenatis libero feugiat eget. Integer semper ex pharetra, consectetur sapien blandit, vestibulum lectus. Sed nec imperdiet erat. Donec id luctus libero. Etiam a venenatis purus. Maecenas quis sem id mi bibendum maximus rutrum nec odio. Fusce vel auctor orci, eget consectetur tellus. Ut iaculis magna a tellus vulputate auctor. Quisque ante eros, condimentum et facilisis sit amet, cursus eu augue. Curabitur diam ex, eleifend sed risus quis, vehicula ultricies quam.") {
//row with checkbox and text
var isChecked by remember { mutableStateOf(false) }
Row() {
Checkbox(checked = isChecked,
onCheckedChange = { isChecked = it })
Text(text = text, overflow = TextOverflow.Ellipsis)
}
}