-
Notifications
You must be signed in to change notification settings - Fork 28.7k
Fix Color Scheme Defaults in Material 3 #112666
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
Fix Color Scheme Defaults in Material 3 #112666
Conversation
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. For more guidance, visit Writing a golden file test for Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. Changes reported for pull request #112666 at sha a3e0252a1784d3ad4e4b63d5d6669def71faa3c8 |
Marked them as positive because the surface color changes a little after we use the default m3 ColorScheme |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work @QuncCccccc. Just a couple of small issues to be resolved and I need to think more about whether we want to try and address #107105 at the same time.
inverseSurface: Color(${tokens[colorTokensDark['md.sys.color.inverse-surface']]}), | ||
onInverseSurface: Color(${tokens[colorTokensDark['md.sys.color.inverse-on-surface']]}), | ||
inversePrimary: Color(${tokens[colorTokensDark['md.sys.color.inverse-primary']]}), | ||
surfaceTint: Color(${tokens[colorTokensDark['md.sys.color.primary']]}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here?
2913bb4
to
2031356
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I think this does address the issue in #107105 at least for the case where they have specified useMaterial3: true
, it will get the same results whether they create the color scheme with a seed in ThemeData or via ColorScheme.fromSeed
. It doesn't fix the case where useMaterial3
is false, but I think that is ok for now.
LTGM. Thx and sorry for the delay on this.
We might want to advertise this change in discord to make sure people are aware that the default M3 color schemes will be changed with this PR. Speaking of which, can we add something to the useMaterial3
flag's docs that describes this new behaviour? Or perhaps something in the constructor for ThemeData
?
2031356
to
3743b9d
Compare
/// use new colors, typography and other features of Material 3. A new | ||
/// purple-based [ColorScheme] will be created and applied to the updated | ||
/// widgets, as long as this is set to true. If false, they will use the | ||
/// Material 2 look and feel. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@darrenaustin Thanks a lot for the suggestions! I just added a comment here. Does this look okay? Wondering if I should add more details.
ed1207f
to
d531956
Compare
@darrenaustin and @QuncCccccc I agree that this merge improves the situation in Material 3, and I do like the new M3 default scheme. However, it does not completely fix the difference between Yes the |
Fixes: #111520
This PR is to create a default light color scheme and a default dark color scheme for
ThemeData
when theThemeData.useMaterial3
is set to be true.To get a M3 light color scheme without setting a seed color, use


ThemeData(useMaterial3: true)
, orThemeData.light(useMaterial3: true)
.To get a M3 dark color scheme, use
ThemeData(useMaterial3: true, brightness: Brightness.dark)
, orThemeData.dark(useMaterial3: true)
.Pre-launch Checklist
///
).