我在我的项目中使用了 coil:0.10.0
但它不符合预期,我想更改图像的背景
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)
)
}
}
预期:
答案 0 :(得分:2)
试试Modifier.background(brush = verticalGradient(listOf(dominantColor, Color.White)))