Created
January 25, 2026 13:47
-
-
Save linreal/93c338a2931b435dabd91349d712ba75 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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