Skip to content

Instantly share code, notes, and snippets.

@rooparsh
Last active October 16, 2020 08:48
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 rooparsh/f9e41366e5c6bb0b3c1fdba774d44077 to your computer and use it in GitHub Desktop.
Save rooparsh/f9e41366e5c6bb0b3c1fdba774d44077 to your computer and use it in GitHub Desktop.
// For handling the state of dialog
private val dialogState by lazy { mutableStateOf(false) }
@Composable
fun CountriesDialog() {
if (dialogState.value) {
SingleSelectDialog(title = getString(R.string.title_select_country),
optionsList = countriesMap.values.toList(),
defaultSelected = countriesMap.keys.toList().indexOf(selectedOption),
submitButtonText = getString(R.string.text_apply),
onSubmitButtonClick = {
/**
* Do whatever you need on button click
*/
},
onDismissRequest = { dialogState.value = false })
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment