Reputation: 623
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(
/* ... */
)
}
}
}
Upvotes: 12
Views: 3961
Reputation: 8122
The padding
modifier should be the last as shown below.
Row(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.fillMaxWidth()
.clickable {
/* ... */
}
.padding(16.dp) ...
)
Upvotes: 35