Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save linreal/cb6f05ffca08ce927a828f2cf58bef6e to your computer and use it in GitHub Desktop.
// Optimized: All effects in one layer, shape evaluated once
@Composable
fun ElegantCard(content: @Composable () -> Unit) {
Card(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
.graphicsLayer {
alpha = 0.95f
shape = RoundedCornerShape(12.dp)
clip = true
shadowElevation = 8.dp.toPx()
}
.background(MaterialTheme.colorScheme.surface)
) {
content()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment