Is it correct to use `androidx.compose.ui.window.D...
# compose
c
Is it correct to use
androidx.compose.ui.window.Dialog
for making a dialog? If yes, How can I dismiss it when I touch out of the dialog(shadow part)?
a
Copy code
var isDialogVisible by remember { mutableStateOf(false) }

if (isDialogVisible) {
    Dialog(
        onDismissRequest = { isDialogVisible = false },
        ...,
    )
}

Button(onClick = { isDialogVisible = true }) {
    Text(text = "show the dialog")
}
Copy code
onDismissRequest = { isDialogVisible = false },
this part handles clicking outside the dialog
the button is there to show the dialog
c
How can I remove focus when the cursor is at some TextField and then click the button? I thought it would loose the focus automatically, but At the moment, dialog opens but focus is on the TextField.
a
Copy code
var isDialogVisible by remember { mutableStateOf(false) }
val focusManager = LocalFocusManager.current

if (isDialogVisible) {
    Dialog(
        onDismissRequest = { isDialogVisible = false },
        ...,
    )
}

Button(onClick = {
    isDialogVisible = true
    focusManager.clearFocus()
}) {
    Text(text = "show the dialog")
}
c
Thank you 🙂
I am using WebView and it's just gray with text.
And if I use
webView.settings
it cause render issue and it says it can't find settings' methods.
Copy code
java.lang.NoSuchMethodError: 'android.webkit.WebSettings android.webkit.WebView.getSettings()'