Last active
January 26, 2025 17:04
-
-
Save igorescodro/32b41f85101100ef2537fab5bd5a63cc 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
| @Composable | |
| fun Modifier.shimmerable( | |
| enabled: Boolean, | |
| color: Color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.6f), | |
| shape: Shape = RoundedCornerShape(8.dp), | |
| ): Modifier { | |
| if (!enabled) return this | |
| return this | |
| .shimmer() // 3rd party library call | |
| .background(color = color, shape = shape) | |
| .drawWithContent { | |
| // Do not draw the actual content. | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment