https://kotlinlang.org logo
#compose
Title
# compose
t

Tower Guidev2

07/07/2022, 2:45 PM
Hi is it just me? or are Jetpack Compose "Out of the box" Dropdown menus "underwhelming"? shouldnt it be easier to add item dividers, ripple effect when items clicked, elevation changes etc or am i missing something? 🤔
👍🏻 1
k

Kirill Grouchnikov

07/07/2022, 2:48 PM
Material components do not "claim" to be as configurable as some people expect them to be. They are implementing a very particular design system, and the more you depart from it, the more it nudges you towards implementing your own components.
c

Casey Brooks

07/07/2022, 2:54 PM
☝️ And don’t forget that the Material components are usually very small, opinionated wrappers on top of more generic components. If you need to diverge from the Material spec for any given component, it’s easy enough to copy the source for the original component and tweak it to your needs. This helps keep the material components themselves from being overwhelmingly configurable, while still giving you the option to customize things as you need. This philosophy is outlined in the Architectural Layering documentation
t

Tower Guidev2

07/07/2022, 2:58 PM
points well made, however a "Ripple" effect when a menu item is clicked doesnt seem too much to ask as "default" behaviour or indeed being able to add menu item dividers. these two seem pretty basic IMHO 😄
c

Casey Brooks

07/07/2022, 3:01 PM
There’s definitely a ripple by default on
DropdownMenuItem
, I just checked it myself. Note that the dropdown doesn’t hide itself when you click an item, so it’s probably that you’re doing something like
DropdownMenuItem(onClick = { handleClick(); dropdownIsVisible = false })
, which will hide the entire dropdown before the animation gets a chance to run. So if you want the animation there, you may need to add a delay yourself so it is visible
🙌 1
And the standard
Divider()
works perfectly fine within the dropdown content, too
t

Tower Guidev2

07/07/2022, 3:07 PM
ooh 😞 the divider was very badly aligned when i tried it 🤦‍♂️ i have the Now In Android catalog app and i cannot see a ripple, maybe its my eyesight 😉
8 Views