0

I have a simple CoilImage implementation in my project where I download an image through an url, and then proceed to move the image state into an Image Composable. That's going smooth so far, but I'm facing a small problem where undesirable paddings are being added to the image. The image composable is inside a column with no fixed height. How can I get rid of these paddings while retaining the image dimension?

enter image description here

I've tried a couple of solutions such as using wrapContentHeight, putting it in a box and clipping it, using contentScale etc, but I just can't seem to get rid of the green spaces.

   @Composable
   fun HorizontalTextWithObject(enumerationItem: TextWithObjectPresentable) {
      Row(modifier = Modifier.fillMaxWidth()) {
        Column(modifier = Modifier.weight(1f), 
        verticalArrangement = Arrangement.Top) {
            Image(modifier = Modifier, enumerationItem)
        }
        Column(modifier = Modifier.weight(2f)) {
            Title(modifier = Modifier, enumerationItem)
            Description(enumerationItem)
        }
      }
    }


    @Composable
    fun Image(modifier: Modifier, 
    enumerationItem:TextWithObjectPresentable) {

    CoilImage(
    { request },
    success = { imageState ->
        imageState.imageBitmap?.let {
            val width = it.width.dp
            val height = ((width / 5) * 3)

            Image(bitmap = it, contentDescription = "",
                modifier = Modifier
                    .width(width)
                    .height(height)
                    .background(SDColor.green),
            )
        }
    },
)
}

I tried ContentScale.Crop but it is not what I'm looking for as it will just fill the paddings heightwise

enter image description here

0 Answers0