Alessandro Marcolini
07/03/2023, 6:13 PMMenu
and its sub-menus (the ones that appear as a popup)?Nick
07/03/2023, 7:18 PMBehavior
there:
// If you're using a custom Theme, you should make it a DynamicTheme so you can bind modules
// for it as follows.
class MyTheme(behaviors: Iterable<Modules.BehaviorResolver>): DynamicTheme(behaviors.filter { it.theme == MyTheme::class })
// This module can then be added to your app
val module = Module(name = "Some Module") {
// This binds a Behavior for Menus that will be included whenever MyTheme is installed
bindBehavior<Menu>(MyTheme::class) {
it.behavior = ..
}
}
you can also create a binding for an existing Theme
(i.e. BasicTheme
) this way and add your module to the app. Then your behavior will be included whenever that theme is installed.
sub-menus get the theme behavior installed just like the root does.Alessandro Marcolini
07/04/2023, 1:06 PMNick
07/04/2023, 9:46 PMTheme
and binding that install a Behavior
based on the View
itself. this would be choosing a value based on the properties of the View
on the line where the Behavior
is set above. this won’t work for your case because a Menu
has no parent or owner to switch on.
2. install a Behavior
manually and set acceptsThemes
to false. this will work for the top-level menu that your code creates; but the sub-menus will revert to any installed Theme
. this is what i need to fix. a root menu should propagate its Behavior
down to sub-menus.