I have a question about getting the loaded picture URL from Coil. The reason why is because I'm using https://unsplash.it/200/200 to get a random image URL which will become something like Image URL, so how can I get the second URL when the image is loaded if I pass the first one to Coil? Here is the code I'm using:
SubcomposeAsyncImage(
modifier = Modifier
.width(imageWidth)
.height(imageHeight)
.align(Alignment.BottomCenter)
.clip(CircleShape),
model = ImageRequest.Builder(LocalContext.current)
.data("https://unsplash.it/200/200")
.crossfade(true)
.build(),
alignment = Alignment.BottomCenter,
contentDescription = "Avatar Image"
) {
val state = painter.state
if (state is AsyncImagePainter.State.Loading) {
Box(
modifier = Modifier.size(10.dp),
contentAlignment = Alignment.Center
) {
CircularProgressIndicator(strokeWidth = 2.dp, color = BlueColor)
}
} else {
SubcomposeAsyncImageContent(
modifier = Modifier.clip(CircleShape),
contentScale = ContentScale.Fit
)
}
}