Last active
December 7, 2023 07:36
-
-
Save mohanmanu484/2b4e3a55b53eb83ea42c30f97061e29b to your computer and use it in GitHub Desktop.
UserItem
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Parcelize | |
| data class CheckBoxState constructor( | |
| val isSelected: Boolean = false, | |
| val name: String = "Checkbox State" | |
| ) : Parcelable | |
| @Composable | |
| fun UserItem() { | |
| var checkBoxState by rememberSaveable { | |
| mutableStateOf(CheckBoxState()) | |
| } | |
| Row( | |
| modifier = Modifier | |
| .fillMaxWidth() | |
| .padding(16.dp), | |
| verticalAlignment = Alignment.CenterVertically | |
| ) { | |
| Checkbox(checked =checkBoxState.isSelected , onCheckedChange = { | |
| checkBoxState =checkBoxState.copy(isSelected = it) | |
| }) | |
| Text(text = checkBoxState.name) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment