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

Want to change its background color by using 'Modifier.background()' #54

Closed
PolyOxyethylene opened this issue Mar 14, 2024 · 1 comment

Comments

@PolyOxyethylene
Copy link

In traditional Compose DropdownMenu, menu's background color can be changed by
Modifier.background(/*certain color*/)

However this doesn't seem to work on CascadeDropdownMenu, its background is only decided by the theme of the application.

@saket
Copy link
Owner

saket commented May 1, 2024

Yep, this is because cascade manually draws the background color between menus to prevent their content from leaking into each other. A better solution would be to clip the canvas of sub-menus, but I haven't found an easy way of doing that yet. In the meantime, modifying the theme is your only option.

MaterialTheme(
  colors = MaterialTheme.colorScheme.copy(surface = …)
) {
  CascadeDropdownMenu(…)
}

@saket saket closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants