What’s the expected visual appearance when multiple dialogs are stacked on top of each other? I would expect (for the visible parts of non-top dialogs) to be progressively darker according to how far down the order they are. However, this is not the case. It seems the darkening is only applied on the top-most dialog.
s
Stylianos Gakis
04/12/2024, 9:32 AM
To be honest I would simply not expect to ever get a dialog on top of a dialog 😅
☝️ 2
😅 2
☝🏾 2
m
Mark
04/12/2024, 11:18 AM
If I didn’t know what I know about the nature & intent of these dialogs, then I’d probably agree with you.
s
Stylianos Gakis
04/12/2024, 11:21 AM
I am afraid to ask for more information now
m
Mark
04/12/2024, 2:41 PM
Solution is to simply hide non top-level dialogs
Copy code
@Composable
fun DialogStack(
dialogState: DialogState,
onDismissRequest: () -> Unit,
dialog: @Composable (
state: DialogState,
onSubDialogState: (DialogState) -> Unit,
onDismissRequest: () -> Unit,
) -> Unit,
) {
var subDialogState: DialogState? by remember {
mutableStateOf(null)
}
if (subDialogState == null) {
dialog(dialogState, { subDialogState = it }, onDismissRequest)
} else {
DialogStack(
dialogState = subDialogState!!,
onDismissRequest = { subDialogState = null },
dialog = dialog,
)
}
}