Lang Minh Nguyên
Lang Minh Nguyên

Reputation: 5465

How to make this custom for Image using Coil

I'm using coil:0.10.0 in my project but it's not as expected, I want to change the image's background

val painter = rememberCoilPainter(
                fadeIn = true,
                request = ImageRequest.Builder(LocalContext.current)
                    .data(entry.imageUrl)
                    .target {
                        viewModel.calcDominantColor(it) { color ->
                            dominantColor = color
                        }
                    }
                    .build()
            )
            Column {   
                Image(
                  painter = painter,
                  contentDescription = entry.pokemonName,
                  modifier = Modifier
                             .size(120.dp)
                             .align(CenterHorizontally)
                )
            }
        }

enter image description here

Expect:

enter image description here

Upvotes: 0

Views: 679

Answers (1)

Richard Onslow Roper
Richard Onslow Roper

Reputation: 6835

Try Modifier.background(brush = verticalGradient(listOf(dominantColor, Color.White)))

Upvotes: 2

Related Questions