1

A code snippet from a Compose-course, which I'm currently doing:

Card(
            modifier = Modifier
                .width(200.dp)
                .height(390.dp)
                .padding(12.dp),
            shape = RoundedCornerShape(corner = CornerSize(15.dp)),
            backgroundColor = Color.White,
            elevation = 4.dp
        ) {
            ...

Why isn't everything attached to the Modifier or everything passed as key-value pairs? What's the special role and meaning of the modifier-object? Why is there this differentiation?

mewi
  • 539
  • 1
  • 4
  • 11
  • because Modifier can modify anything that is a composable and receives a Modifier, see https://cs.android.com/androidx/platform/tools/dokka-devsite-plugin/+/master:testData/compose/source/androidx/compose/foundation/layout/Padding.kt;l=344?q=PaddingModifier – EpicPandaForce Dec 18 '21 at 06:42

0 Answers0