I am trying to use Compose in my app.
I want to draw a UI like below.
It has Title and Description with a Switch.
My code is here:
@Composable
fun Switch2Lines(
@StringRes title: Int,
@StringRes desc: Int
) {
Row(
verticalAlignment = Alignment.CenterVertically,
) {
Column {
Text(
text = "Title",
modifier = Modifier.padding(top = 16.dp),
fontSize = 18.sp
)
Text(text = "Desc Desc Desc Desc Desc Desc Desc Desc Desc Desc")
}
Switch(
checked = true,
onCheckedChange = {},
modifier = Modifier.wrapContentSize()
)
Spacer(modifier = Modifier.padding(16.dp))
}
}
In this case, Description is too long.
So the Switch is laid out incorrectly.
I added a Spacer end of the Switch, but it doesn't work.
How can I fix this? Should I use the constraintlayout-compose?
