I have issue that image is stretched for 1 second and then comes back as is should be. Im using Coil and Compose.
topBar = {
TopAppBar(
modifier = Modifier.padding(
top = (0.03 * screenHeightDp),
start = (0.08 * screenWidthDp),
end = (0.08 * screenWidthDp)
),
elevation = 0.dp,
title = {
Row(
modifier = Modifier
.fillMaxWidth()
.height(32.dp)
.padding(end = 0.08 * screenWidthDp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center
) {
val logoPath =
context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)
.toString() + "/logo_image.svg"
ImageComponent(
imagePath = logoPath,
contentDescription = "logo",
modifier = Modifier
.fillMaxWidth(),
maxHeight = 32
)
}
},
And image component:
val painter = rememberAsyncImagePainter(
model = ImageRequest.Builder(context = LocalContext.current)
.data(imgFile)
.decoderFactory(SvgDecoder.Factory())
.error(fallbackImageResource)
.build()
)
Image(
painter = painter,
contentDescription = contentDescription,
modifier = modifier.height(maxHeightImage.dp),
How to prevent image (.svg) streching