Replies: 2 comments 8 replies
-
This is intended behaviour since |
Beta Was this translation helpful? Give feedback.
-
A workaround i got was to create a separate on the view model private fun fetchColors(context: Context) {
viewModelScope.launch {
// Requesting the image using coil's ImageRequest
val req = ImageRequest.Builder(context)
.data(_artist.value?.imageURL)
.allowHardware(false)
.build()
val result = Coil.execute(req)
if (result is SuccessResult) {
// Save the drawable as a state in order to use it on the composable
_imageDrawable.value = result.drawable
// Converting it to bitmap and using it to calculate the palette
resolveColorsFromBitmap(result.drawable.toBitmap())
}
}
} and on the composable val painter = rememberImagePainter(
imageDrawable
) Edit: Setting the drawable directly to the imagePainter instead of converting to bitmap. Also changed the code to make it simpler |
Beta Was this translation helpful? Give feedback.
-
Hello Dev Community, I'm having trouble using "target "in composable, I am using the latest version of coil compose, and here's the code I am using:
after building the app, i am getting this error:
I have searched all over the stack overflow and over the issues and discussions here, couldn't find any solution for this I really appreciate it if anyone can tell me what is wrong with this? and if I am using it the wrong way.
Beta Was this translation helpful? Give feedback.
All reactions