I need to show an image in my app by url using Coil, but this image don't load. I follow the official documentation https://coil-kt.github.io/coil/compose/.
implementation "io.coil-kt:coil-compose:1.3.1"
@Composable
fun ProfilePicture(profilePicture: String, online: Boolean) {
Card(
shape = CircleShape,
border = BorderStroke(
width = 2.dp,
color = if (online) MaterialTheme.colors.lightGreen else Color.Red
),
modifier = Modifier.padding(16.dp),
elevation = 4.dp
) {
Image(
painter = rememberImagePainter(
data = profilePicture,
builder = {
transformations(CircleCropTransformation())
}
),
modifier = Modifier.size(72.dp),
contentDescription = "Profile picture"
)
}
}
Update
An exemplo to UserModel
UserModel(
name = "John Doe",
profilePicture = "https://randomuser.me/api/portraits/men/32.jpg",
online = true
)
profilePicture
that's not working – Letty