Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rounded corner only at top of image AysncImage Coil

I'm using the new AysncImage loader for compose inside a Box. The Box itself has a RoundedCornerShape. I have also added a RoundedCornerShape for the AsyncImage with the following values

Box(
    modifier = modifier.clip(RoundedCornerShape(16.dp))
) {
    AsyncImage(
        modifier = Modifier
            .height(146.dp)
            .clip(shape = RoundedCornerShape(
                topStart = 16.dp,
                topEnd = 16.dp,
                bottomStart = 0.dp,
                bottomEnd = 0.dp)
            ),
        model = R.drawable.image,
        contentDescription = null,
        contentScale = ContentScale.Crop
    )
}

But the image is rounded at all corners. Screen Shot here

I don't want the image to have rounded corners at bottom.

like image 234
Sohail Shah Avatar asked Dec 03 '25 09:12

Sohail Shah


1 Answers

Add this modifier to your AsyncImage

 modifier = Modifier.clip(RoundedCornerShape(topEnd = 8.dp , topStart = 8.dp))
like image 177
Hesham Yemen Avatar answered Dec 05 '25 22:12

Hesham Yemen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!