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
Zoff
11/02/2023, 4:51 PM
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
Sean Proctor
11/03/2023, 2:41 AM
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
Ralf Stephan
11/03/2023, 7:55 AM
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
Dragos Rachieru
11/03/2023, 7:42 PM
You should ask compose related questions in the #compose channel
This channel is used for compose desktop and multiplatform
c
Chris Sinco [G]
11/07/2023, 4:24 AM
For future reference, including a code snippet would be very helpful for troubleshooting