I have an app that has 12 buttons and each one of them has a Character when clicked that Character will be added to a variable called answer which will be displayed in a Text. I want those buttons to disapear as soon as they are clicked i know i can use something like :
var answer by remember {
mutableStateOf("")
}
var state by remember {
mutableStateOf(true)
}
var alpha by remember {
mutableStateOf(1f)
}
Text(text = answer)
Button(onClick = {
answer=answer.plus(arrayList[0])
alpha = 0f
state = false
},enabled = state,
modifier = Modifier.alpha(alpha)) {
Text(text = arrayList[0])
}
But I don't want to create 2 variables for each button (24 variables) is there a better way to do it pleaase.