Skip to content

Instantly share code, notes, and snippets.

@linreal
Created January 25, 2026 13:47
Show Gist options
  • Select an option

  • Save linreal/93c338a2931b435dabd91349d712ba75 to your computer and use it in GitHub Desktop.

Select an option

Save linreal/93c338a2931b435dabd91349d712ba75 to your computer and use it in GitHub Desktop.
// Optimized - precise, performant, and predictable
@Composable
fun ListItem(title: String, subtitle: String, onClick: () -> Unit) {
Row(
modifier = Modifier
.fillMaxWidth() // 1. Layout: Define the width
.padding(16.dp) // 2. Layout: Create space within those bounds
.background( // 3. Appearance: Draw the background in the padded area
color = Color.LightGray,
shape = RoundedCornerShape(8.dp)
)
.clickable { onClick() } // 4. Interaction: Make the final visible area clickable
) {
// ... Content
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment