saket / cascade

Nested popup menus with smooth height animations for Android

Home Page:https://saket.github.io/cascade

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

PolyOxyethylene opened this issue · comments

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.

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