material-foundation / flutter-packages

A collection of useful Material Design packages
https://pub.dev/publishers/material.io
Apache License 2.0
824 stars 144 forks source link

``surfaceContainer`` is a complete white color, when it shouldn't be #595

Closed JGeek00 closed 3 days ago

JGeek00 commented 2 weeks ago

Package

dynamic_color

Existing issue?

What happened?

Expected vs actual result:

I think this started happening with Flutter v3.22, because previously I didn't had to define the cardTheme, popupMenuTheme, and navigationBarTheme to match the colors of the Material 3 specification, but currently if I don't define that parameters with the correct background color, the background color of that components is rendered white.

image image image

If I don't use the dynamic color scheme and instead I use a normal color, it works fine.

image image image

This happens because now the surfaceContainer color is completely white (I mean rgb(0, 0, 0)), and according to the Material 3 specification, that color is the one that has to be used for the container background.

https://m3.material.io/components/cards/specs

image

https://m3.material.io/components/menus/specs

image

https://m3.material.io/components/navigation-bar/specs

image

If I define that colors on the teme with surfaceTint instead of with surfaceContainer, the correct color is applied.

  cardTheme: CardTheme(
    surfaceTintColor: dynamicColorScheme?.surfaceTint
  ),
  popupMenuTheme: PopupMenuThemeData(
    surfaceTintColor: dynamicColorScheme?.surfaceTint
  ),
  navigationBarTheme: NavigationBarThemeData(
    surfaceTintColor: dynamicColorScheme?.surfaceTint
  )

Relevant log output

No response

Zensonaton commented 1 week ago

I have no idea who from the Flutter team thought that making this breaking change is a good idea.

Why haven't they passed dynamicSchemeVariant: DynamicSchemeVariant.fidelity by default? Ew.

guidezpl commented 3 days ago

Closing as dupe (e.g. #591)