Skip to content

Instantly share code, notes, and snippets.

@phatnhse
Created July 29, 2023 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phatnhse/0bf18343b15ace56bbf3f77956124cd8 to your computer and use it in GitHub Desktop.
Save phatnhse/0bf18343b15ace56bbf3f77956124cd8 to your computer and use it in GitHub Desktop.
jc-sample-row
@Composable
fun Sample() {
var button1 by remember { mutableStateOf("button 1") }
var button2 by remember { mutableStateOf("button 2") }
Column(horizontalAlignment = Alignment.CenterHorizontally) {
Button(onClick = { button1 += "1" }) { Text(text = button1) }
Spacer(modifier = Modifier.height(8.dp))
Button(onClick = { button2 += "2" }) { Text(text = button2) }
// New row added here, expected to recompose when button1 changes.
Row {
Text(text = button1)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment