admin管理员组文章数量:1300203
I'm loading the same image (from the netowrk) on different ASyncImage composables: one is "full screen" and it's blurred, the other is on top and represent the sharp version of the image. Sometimes the image loading don't take place at the same time leading to a poor UX.
Here is the code:
@Composable
fun BlurredAsyncImage(
url: String,
imageLoader: ImageLoader,
blurRadius: Dp = 50.dp
) {
Box(
modifier = Modifier
.fillMaxSize(),
contentAlignment = Alignment.Center
) {
// blurred image as background
AsyncImage(
imageLoader = imageLoader,
model = buildImageRequest(
itemId = itemId,
url = url
),
contentScale = ContentScale.Crop,
modifier = Modifier
.fillMaxWidth()
.blur(blurRadius)
)
// sharp image as foreground
AsyncImage(
imageLoader = imageLoader,
model = buildImageRequest(
itemId = itemId,
url = url
),
contentScale = ContentScale.Fit,
modifier = Modifier
.fillMaxWidth()
)
}
}
@Composable
private fun buildImageRequest(
itemId: Long,
url: String
) = ImageRequest.Builder(LocalContext.current)
.data(url)
.build()
Do you have any hint on how I can make them appear simultaneously?
本文标签: androidHow to synchronize images loading with Coil3Stack Overflow
版权声明:本文标题:android - How to synchronize images loading with Coil3 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741654012a2390647.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论