I came across a possible bug related to
IconButton
and
Icon
. I'm developing a VideoPlayer fully written in Compose and wanted to add on-screen play/pause button. These icons need to be differentiable on video, so that I chose to use white for icon colors and draw shadow around them. Code looks something like this
IconButton(
onClick = {
mediaPlayer.toggle()
playButtonUiState = mediaPlayer.isPlaying
}
) {
Icon(
asset = if (playButtonUiState) Icons.Filled.Pause else Icons.Filled.PlayArrow,
modifier = Modifier.drawShadow(elevation = 2.dp)
)
}
Without shadow, everything seems like to work. State changes and icon is updated when clicked on the button. However, when I add shadow as in the example, icon stops changing. Functionality works but icon gets fixed to
Pause
. Is there something wrong with my code or is this might be a bug?