Nana Vong
06/01/2021, 6:36 AMdata class Question(var add: Boolean = true)
val testState = MutableLiveData<List<Question>>()
testState.value = listOf(Question(false))
val state = testState.observeAsState()
RedButton(
text = state.value?.get(0)?.add?.toString() ?: "?",
btnColor = Color.Red,
modifier = Modifier.clickable {
testState.value = testState.value.apply {
this?.get(0)?.add = true
}
})Luke
06/01/2021, 6:46 AMNana Vong
06/01/2021, 7:06 AMAlbert Chang
06/01/2021, 7:12 AMdata class Question(val add: Boolean = true)) and use a mutableStateListOf<Question>(). Then you update the item like this: list[0] = Question(add = false).Albert Chang
06/01/2021, 7:14 AM