I'm using coil library to load images in my composable view and I want to define fix height and width for my coil Image composable, however the modifier is missing in the coil Image composable class, following is the code snippet I'm using.
AsyncImage(
model = limit.imgUrl,
contentDescription = null
)
How I can make the width and height fixed irrespective of the image resolution.
Use the Modifier to set the width and height, but be sure to set contentScale = ContentScale.FillBounds
, or it won't resize the image properly:
AsyncImage(
model = limit.imgUrl,
contentDescription = null,
contentScale = ContentScale.FillBounds,
modifier = Modifier.height(60.dp).width(80.dp)
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With