androidx.compose.ui.window
Dialog
Composable function · from org.jetbrains.compose.ui:ui:1.12.2
One of the windows. It works like Popup. Only the parameters that differ are described here.
A Dialog shows content in the middle of the screen, with a dim layer behind it. The user can't use the rest of the app until it closes.
if (showDialog) {
Dialog(onDismissRequest = { showDialog = false }) {
Surface(shape = MaterialTheme.shapes.extraLarge) { MyForm() }
}
}
In Material apps, AlertDialog and BasicAlertDialog give you the right shape, colors and button layout.
Parameters
@Composable
fun Dialog(
onDismissRequest: () -> Unit,
properties: DialogProperties = DialogProperties(),
content: @Composable () -> Unit,
)
onDismissRequest: () -> UnitRequired
onDismissRequest: () -> UnitRequiredCalled when the user taps outside or presses back or Escape. Set your state to false here.
properties: DialogPropertiesOptional
properties: DialogPropertiesOptionalDefault: DialogProperties()
Whether the popup takes focus, closes on outside taps, and more. See PopupProperties or DialogProperties.
Windows
PopupDialog