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

bodo

10/11/2021, 1:59 PM
Hi. Can you please tell me why padding is not working in this composable:
Copy code
Surface(
    modifier = Modifier.padding(10.dp)
    shape = AppTheme.shapes.medium,
    color = AppTheme.colors.surface
  ) {
  content()
}
It is only working when i add a box around the content(). is this the correct way to do it???
Copy code
Surface(
    shape = AppTheme.shapes.medium,
    color = AppTheme.colors.surface
  ) {
  Box(modifier = Modifier.padding(10.dp)) {
    content()
  }
}
d

divid3d

10/11/2021, 3:25 PM
Surface content lambda is passing PaddingValues:
content: @Composable (PaddingValues) → Unit
7 Views