-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ThemeData.from ignore colorPrimary when brightness is dark #48195
Comments
After spending few moments checking the themedata from method content, i see that the colorPrimary property is ignored if the brighness is dark.
|
After spending few moments checking the tests for this method, i see that this is intended but it's not specified in the docs of the method, ThemeData.from.
|
If this is intended then why the ColorScheme.dark does not use black as primary ? Theme.of(context).primaryColor This behavior completely break the expected result of such behavior. |
maybe @darrenaustin can put some light on why such strict restrictions ? |
I think the root problem here is how AppBar relates to the theme, see #54776 (comment) However, I may have interpreted this issue incorrectly. The DartPad link, https://dartpad.dev/b6409e10de32b280b8938aa75364fa7b, doesn't seem to be the test case you've described. |
@HansMuller Yes the dart pad link seems broken. my issue is this line
Since many widget are currently dependent on ThemeData.primaryColor and not ThemeData.colorScheme.primaryColor. in dark mode many widget does not reflect the primary colour specified in the colorScheme. |
Right. ThemeData.from() tries pretty hard to be backwards compatible in terms of the old ThemeData properties. Until we wean the Material components off of those old ThemeData properties, problems like this one will persist. We are moving in that direction, but it's going to take a while. |
@HansMuller would be amazing to have a GitHub project https://github.com/flutter/flutter/projects to track all the changes that need to be applied in order to get to that point. Simple and consistent theming really help achieve design perfect apps that make our clients and users happier. Thanks for the hard work. |
Code Sample
flutter doctor -v
|
Ran into the same issue. Any update on it? What would be a good work around for this meanwhile? |
@bitsydarel Can you share full code example for ColorScheme? |
Reproduces on 3.3 and master 3.7 flutter doctor -v (mac)
cc: @darrenaustin |
Steps to Reproduce
Result:
the app bar color does not match the primary color so then the text appbar is not visible.
Here's a dart pad example showing the issue https://dartpad.dev/b6409e10de32b280b8938aa75364fa7b
Target Platform:
Any
Target OS version/browser:
Any
Devices:
Any
The text was updated successfully, but these errors were encountered: