7

I have a Row component which is not clickable on its whole area because of padding modifier. How can I make this component clickable on whole area with the same padding effect?

@Composable
fun UserRow() {
        Row(
            verticalAlignment = Alignment.CenterVertically,
            modifier = Modifier
                .fillMaxWidth()
                .padding(16.dp)
                .clickable {
                    /* ... */
                }
        ) {
            Icon(
                /* ... */
            )
            Text(
                /* ... */
            )
        }
    }
}
AndroideuszPL
  • 385
  • 1
  • 2
  • 13

1 Answers1

13

The padding modifier should be the last as shown below.

 Row(
            verticalAlignment = Alignment.CenterVertically,
            modifier = Modifier
                .fillMaxWidth()
                .clickable {
                    /* ... */
                }.padding(16.dp) ...
}
Tonnie
  • 4,865
  • 3
  • 34
  • 50