another question. i have an IconButton() with a vi...
# compose-desktop
z
another question. i have an IconButton() with a videocall symbol and i want to make it red colored when a video call is active. the state is in an data class. for some reason i can't make the icon change when the state changes
i have solved it now. but most likely not in a proper way. is there a good tutorial to explain all these state, stateflow, mutablestate etc. in a very easy to understand way? all tutorials i found were a bit hard to understand. specially for a non english native speaker
s
I'm not the best one to answer this, but I'll make an attempt. I am a native english speaker, and the android tutorials are very helpful for me. Flow and associated Kotlin coroutine types can be turned into a Compose State. Any change in a State or passed argument will cause a recomposition which is expensive, but will make sure everything is updated how you want. For color changes, you can read the value from a lambda, to prevent recomposition. This guide is pretty helpful: https://developer.android.com/jetpack/compose/phases
r
Also, if I understand it correctly, where you define your State in the Composable tree affects how much is re-rendered on State change. Important also that if you have a class as state, make it a data class because these are hashable, and the hash is where the change is detected.
d
You should ask compose related questions in the #compose channel This channel is used for compose desktop and multiplatform
c
For future reference, including a code snippet would be very helpful for troubleshooting