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

Lilly

10/21/2023, 12:14 AM
Is this a bug I'm facing:
Copy code
@Preview
@Composable
private fun Test() {
    Surface(
        modifier = Modifier.size(200.dp),
        color = Color.Gray
    ) {
        Row(
            modifier = Modifier
                .width(100.dp)
                .height(10.dp)
                .background(Color.Blue)
        ) {
            Text(text = "sdfsdf")
        }
    }
}
Surface
is 200 in size with gray background but Preview shows a filled blue background, wtf? The
Row
does not respect the size. Can someone confirm this?
f

Francesc

10/21/2023, 2:16 AM
Surface uses propagateMinConstraints, you have to disable that, or use a Box