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

Fixes Dropdown wrong default color #40

Closed MV-GH closed 1 year ago

MV-GH commented 1 year ago

According to the m3 specs, dropdown has a 3dp tonal elevation, this was missing and caused the discrepancy between DropdownMenu and CascadeDropdownMenu. See https://m3.material.io/styles/elevation/tokens#df721a00-888e-4c5e-bfe1-5d905f167aaa

After:

https://github.com/saket/cascade/assets/67873169/4d59acd9-4159-4c2a-834e-d3bdc0d9d5e8

Before:

https://github.com/saket/cascade/assets/67873169/4008fd78-c6d5-42e7-9202-a39f8f033dcd

Fixes #39

saket commented 1 year ago

Can you regenerate test screenshots using and add them to this PR?

./gradlew cascade-compose:connectedDebugAndroidTest -Pdropshots.record
MV-GH commented 1 year ago

I generated them using a Pixel 7 API 31.

MV-GH commented 1 year ago

Made some small changes, I saw that it was setting the shadowElevation to the tonalElevation. And made a argument for tonalElevation

MV-GH commented 1 year ago

There was a test with this remark

// Drop shadows are strangely causing tiny differences in // generated screenshots. A zero elevation is used to avoid this. private val shadowElevation = 0.dp

This was actually changing the tonalElevation and now it actually changes the shadowElevation

Not sure if this is still needed?

saket commented 1 year ago

I'm sorry this took me some time. trunk has moved ahead so let me land your changes manually.