Skip to content

How to calculate Card background color if it has non-zero elevation? #50

Closed Answered by rydmike
dannylin108 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @dannylin108, thanks for your question.

Yes, if the useMaterial3 is false, so that we are using Material2 styles, and when applyElevationOverlayColor is true, which it in Material2 should only be in dark mode (FlexColorScheme defaults to this), then the background color will change with higher elevation and get lighter automatically in dark mode.

This only happens if the used background color of the elevated material has the same color as Theme.of(context).colorScheme.surface. Some FlexColorScheme surfaceModevalues will use a blend strength for ThemeData.backgroundColor that makes it diverge from surface (and canvasColor), such surfaces will then not get an overlay color in dark mode, …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dannylin108
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question This issue is a usage question and will be moved to the Discussions section.
2 participants