Skip to content

Instantly share code, notes, and snippets.

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

  • Save linreal/50132bbc337ae5ed39a6d95f155fe14e to your computer and use it in GitHub Desktop.

Select an option

Save linreal/50132bbc337ae5ed39a6d95f155fe14e to your computer and use it in GitHub Desktop.
// Before: A typical "just make it work" modifier chain
// Before: "works", but heavier than it looks
Modifier
.clickable { onMessageClick() } // hit-test too early
.padding(horizontal = 12.dp, vertical = 6.dp)
.background(
color = MaterialTheme.colorScheme.surfaceVariant,
shape = RoundedCornerShape(12.dp)
)
.fillMaxWidth()
.padding(8.dp) // extra layout work
.alpha(0.98f) // layer A
.clip(RoundedCornerShape(12.dp)) // layer B + path work
.shadow(4.dp, RoundedCornerShape(12.dp)) // layer C (often)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment