Md. Nazmun Sadat Khan
07/29/2021, 5:48 AMOleksandr Balan
07/29/2021, 6:11 AMderivedStateOf
See: https://developer.android.com/reference/kotlin/androidx/compose/runtime/package-summary#derivedStateOf(kotlin.Function0)Md. Nazmun Sadat Khan
07/29/2021, 6:21 AMvar scale by remember {
derivedStateOf {
imageBitmap
0f
}
}
Would the code look something like this? Would it reset to 0 whenever imageBitmap changes?Oleksandr Balan
07/29/2021, 6:25 AMMd. Nazmun Sadat Khan
07/29/2021, 6:32 AMremember
had a key
argument. I think that's what I am looking for.
So the code should look this, right?
var scale by remember(imageBitmap) { 0f }
One other thing, it's a minor question but why are all the key arguments named key1
? key
doesn't seem to be a keyword in Kotlin.Oleksandr Balan
07/29/2021, 6:36 AMscale
to be a mutable state, so:
var scale by remember(imageBitmap) { mutableStateOf(0f) }
There are also key2
and key3
, so that’s why they choose key1
for name of the first key 🤷Md. Nazmun Sadat Khan
07/29/2021, 6:38 AMmutableStateOf
Thanks for all your help! 😊