Created
October 28, 2023 13:40
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