-
-
Save tolgaprm/9819e32766776df165b078c282cc3c75 to your computer and use it in GitHub Desktop.
This file contains 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
class MainActivity : ComponentActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
Stability_ImmutabilityTheme { | |
val (isChecked, onChecked) = remember { mutableStateOf(false) } | |
Column( | |
modifier = Modifier | |
.fillMaxSize() | |
.background(MaterialTheme.colorScheme.background), | |
) { | |
Checkbox( | |
checked = isChecked, | |
onCheckedChange = onChecked | |
) | |
ContactList( | |
contactListState = ContactListState( | |
names = listOf("name1", "name2", "name3", "name4"), | |
) | |
) | |
} | |
} | |
} | |
} | |
} | |
@Composable | |
fun ContactList( | |
contactListState: ContactListState | |
) { | |
if (contactListState.isLoading) { | |
CircularProgressIndicator() | |
} else { | |
Text(text = contactListState.names.toString()) | |
} | |
} | |
data class ContactListState( | |
val names: List<String>, | |
val isLoading: Boolean = false, | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment