saket / cascade

Nested popup menus with smooth height animations for Android
https://saket.github.io/cascade
Apache License 2.0
2.02k stars 67 forks source link

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

Closed PolyOxyethylene closed 5 months ago

PolyOxyethylene commented 7 months ago

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 commented 5 months ago

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(…)
}