Created
October 28, 2023 13:40
-
-
Save Mikkareem/f7fc3f7e8cb967f69007f9a779367459 to your computer and use it in GitHub Desktop.
Glassy Feel of Image in Jetpack Compose
This file contains 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
@Preview | |
@Composable | |
private fun GlassyImage() { | |
Box( | |
modifier = Modifier, | |
contentAlignment = Alignment.Center | |
) { | |
Image( | |
painter = painterResource(id = R.drawable.sample_profile1), | |
contentDescription = null, | |
// Play Around with the scale to adjust the aspect ratio | |
contentScale = FixedScale(1.3f) | |
) | |
Image( | |
painter = painterResource(id = R.drawable.sample_profile1), | |
contentDescription = null, | |
contentScale = FixedScale(1f), | |
modifier = Modifier.padding(32.dp) | |
.shadow( | |
elevation = 24.dp, | |
shape = RoundedCornerShape(24.dp) | |
) | |
.graphicsLayer { | |
renderEffect = BlurEffect( | |
radiusX = 1.dp.toPx(), | |
radiusY = 1.dp.toPx() | |
) | |
shape = RoundedCornerShape(24.dp) | |
clip = true | |
} | |
) | |
} | |
} |
Author
Mikkareem
commented
Oct 28, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment