Satyam G
05/25/2022, 12:48 PMColton Idle
05/25/2022, 1:35 PMSatyam G
05/25/2022, 1:38 PM@Composable
fun MyImageWrapper(
modifier: Modifier = Modifier,
imageUrl: String? = null,
imageDrawable: Int? = null,
contentScale: ContentScale = ContentScale.Crop,
loadingDrawable: Int? = null,
errorDrawable: Int? = null,
alignment: Alignment = Alignment.Center,
errorView: @Composable () -> Unit = {
errorDrawable?.let {
Image(
painter = painterResource(id = errorDrawable),
contentDescription = ""
)
}
},
loadingView: @Composable () -> Unit = {
loadingDrawable?.let {
Image(painter = painterResource(id = loadingDrawable), contentDescription = "")
}
}
) {
GlideImage(modifier = modifier, imageModel = imageUrl ?: imageDrawable, loading = {
loadingView()
}, failure = {
errorView()
}, alignment = alignment, contentScale = contentScale, contentDescription = "")
}
If I am using this Composable for displaying Images for Item in LazyLayout, will it be optimised internally or I have to maintain states for Images etc to avoid recompositions is my query