Want to change its background color by using 'Modifier.background()'
PolyOxyethylene opened this issue · comments
Qingyuan Su commented
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 Narayan commented
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(…)
}