Halil Ozercan
07/14/2020, 10:41 PMIconButton
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?Timo Drick
07/14/2020, 10:58 PMif (playButtonUiState)
Icon(
asset = Icons.Filled.Pause,
modifier = Modifier.drawShadow(elevation = 2.dp)
)
else
Icon(
asset = Icons.Filled.PlayArrow,
modifier = Modifier.drawShadow(elevation = 2.dp)
)
Chuck Jazdzewski [G]
07/14/2020, 11:29 PMHalil Ozercan
07/15/2020, 7:40 AMTimo Drick
07/15/2020, 9:05 AMNader Jawad
07/22/2020, 5:46 AMTimo Drick
07/22/2020, 9:19 AMHalil Ozercan
07/22/2020, 9:34 AMdev14