Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AlertDialog is too narrow by default #2836

Closed
m-sasha opened this issue Mar 7, 2023 · 2 comments · Fixed by JetBrains/compose-multiplatform-core#433
Closed

AlertDialog is too narrow by default #2836

m-sasha opened this issue Mar 7, 2023 · 2 comments · Fixed by JetBrains/compose-multiplatform-core#433
Assignees
Labels
bug Something isn't working

Comments

@m-sasha
Copy link
Member

m-sasha commented Mar 7, 2023

Describe the bug
If you don't specify a concrete width for an AlertDialog, it attempts to display it as narrowly as possible, which often leaves a lot of unused horizontal space that could be used for a better result.

Reproducer:

@OptIn(ExperimentalMaterialApi::class)
fun main() = singleWindowApplication(
    state = WindowState(width = 400.dp, height = 300.dp),
) {
    MaterialTheme{
        AlertDialog(
            onDismissRequest = {},
            title = { Text("This is the title") },
            text = { Text("This is the text") },
            confirmButton = { }
        )
    }
}

Affected platforms
Select one of the platforms below:

  • All

Versions

  • Compose Multiplatform version: 1.3.0

Expected behavior
The alert dialog should be wider, not breaking lines as long as there is more horizontal room.

Screenshots
image

@m-sasha m-sasha added the bug Something isn't working label Mar 7, 2023
@m-sasha m-sasha self-assigned this Mar 7, 2023
@m-sasha
Copy link
Member Author

m-sasha commented Mar 11, 2023

Another important issue caused by the same problem is that widthIn is ignored:

@OptIn(ExperimentalMaterialApi::class)
fun main() = singleWindowApplication(
    state = WindowState(width = 500.dp, height = 400.dp),
) {
    MaterialTheme{
        AlertDialog(
            modifier = Modifier.widthIn(max = 400.dp).padding(horizontal = 30.dp),
            onDismissRequest = { },
            title = { Text("This is the title") },
            text = { Text("This is the text This is the text This is the text This is the text This is the text This is the text This is the text") },
            confirmButton = {}
        )
    }
}

image

@okushnikov
Copy link
Collaborator

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

@JetBrains JetBrains locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants