Anthony Martin
10/01/2021, 3:32 PMAlertDialog
work with Compose Preview
? I can't get it to work as it's saying "_The graphics preview in the layout editor may not be accurate - The preview does not support multiple windows._"
Just trying to gain an understanding on what's doing wrong.
Code:
@Preview
@Preview(uiMode = Configuration.UI_MODE_NIGHT_YES)
@Composable
private fun SimpleComposeUIPreview() {
AppTheme {
DialogUI(
message = "This is an example dialog message...",
onPopBackStack = {}
)
}
}
@Composable
private fun DialogUI(
title: String = stringResource(R.string.title),
message: String,
positiveBtn: String = stringResource(R.string.pos),
onPopBackStack: () -> Unit
) {
AlertDialog(
onDismissRequest = onPopBackStack,
title = {
Text(text = title)
},
text = {
Text(text = message)
},
confirmButton = {
TextButton(
onClick = onPopBackStack,
) {
Text(positiveBtn)
}
},
)
}
Using version 1.1.0-alpha04 for ComposeAlbert Chang
10/01/2021, 3:39 PMAnthony Martin
10/01/2021, 3:45 PM