Shakil Karim
07/09/2021, 5:31 AMTash
07/09/2021, 6:50 AMTash
07/09/2021, 6:52 AMbadge.value
and not the badge
MutableState
instance. might be easier to use property delegates and write it as var badge by mutableStateOf<Badge?>
instead so that you can read/write to it as a regular var
.Shakil Karim
07/09/2021, 10:35 AMpack.badgeText = OPEN(context.getString(R.string.open))
Zach Klippenstein (he/him) [MOD]
07/09/2021, 4:16 PMShakil Karim
07/10/2021, 6:50 PMval packBadges = mutableStateMapOf<String,BADGE?>()
and on the Observing side
PackItem(
modifier = Modifier
.width(boxWidth)
.padding(horizontal = 8.dp),
entry.packName,
entry.lections.map { it.name }.joinToString { it },
emojiText = entry.emoji,
coins = entry.coins,
bagText = packBadges["${entry.lang}${entry.pacId}${entry.packOwnerId}${entry.func}"]
) {
onPackSelected(entry)
when(packBadges["${entry.lang}${entry.pacId}${entry.packOwnerId}${entry.func}"]) {
is OPEN -> onOpenLections()
is GET -> getLections()
is COIN -> getLectionsWithCoins(entry.coins)
}
}