my task is to make favorite button with jetpack compose.
On my picture in top left corner I should put favorite icon.
I managed to make picture:
Box(modifier = Modifier.height(200.dp)){
Image(
painter = movie.picture,
contentDescription = "Something",
contentScale = ContentScale.Crop
)
ListItem (
trailing = {
if (movie.isCheckedOff != null) {
Checkbox(
checked = movie.isCheckedOff,
onCheckedChange = { isChecked ->
val newMovieState =
movie.copy(isCheckedOff = isChecked)
onMovieCheckedChange.invoke(newMovieState)
},
modifier = Modifier.padding(8.dp)
)
}
This makes image and does logic for Checkbox ( I don't want to use checkbox). Should I have 2 images and then use one if button is true and another if false. I have problem with displaying favorite picture and then switching it on and off.
