I need to create a Dialog with wrapcontentheight i...
# compose
p
I need to create a Dialog with wrapcontentheight in the modifier but seems that Dialog doesn't accept a modifier. Any help about how to solve this? Thank you
a
p
hi @Adel Ayman how can I set the desired heigh with that dialog?
a
As default it will be wrap content height and you can add modifier to change height to specific height
p
why wrap content? i'm implementing Dialog in compose-desktop and seems to put more heigh than the content, and I tryed adding height to the main Box but doesn't reduce the dialog
seems that wrap content doesn't work, even setting height to the box doesn't work
a
It work properly with me can you share your code?
p
Copy code
@Composable
fun MessageDialog(dialogText: String, onDismiss: () -> Unit) {
    Dialog(
        title = "",
        onCloseRequest = {onDismiss()},
        state = rememberDialogState(position = WindowPosition(Alignment.Center))
    ) {
        Row {
            Box(modifier = Modifier.padding(20.dp), contentAlignment = Alignment.Center) {
                Text(text = dialogText, textAlign = TextAlign.Center)
            }
        }
    }
}
If I set a heigh with a modifier to the Row or the Box, both are ignored
are you testing in compose-desktop multiplatform?
a
I tried it now in android and it work well, No i didn’t test it in desktop
p
maybe it's a compose-desktop issue
thank you for trying
312 Views