我尝试在按下按钮时显示 AlertDialog。对于 AlertDialog 我有一个可组合函数 - showDialog。很明显这个函数调用了一个对话框。我有另一个可组合函数,它显示一些带有文本和按钮的窗口。单击按钮时,我想调用一个存储 AlertDialog 的函数。
警报对话框主体:
fun monthDialog() {
val openDialog = remember { mutableStateOf(true) }
if (openDialog.value) {
AlertDialog(
onDismissRequest = {
openDialog.value = false
},
title = {
Text(text = "Title")
},
text = {
Text(
"This area typically contains the supportive text " +
"which presents the details regarding the Dialog's purpose."
)
},
buttons = {
Row(
modifier = Modifier.padding(all = 8.dp),
horizontalArrangement = Arrangement.Center
) {
Button(
modifier = Modifier.fillMaxWidth(),
onClick = …Run Code Online (Sandbox Code Playgroud)