-
Notifications
You must be signed in to change notification settings - Fork 28.7k
Refactor ThemeData #91497
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
Refactor ThemeData #91497
Conversation
This is likely to be a rather tedious undertaking, since all of the parameter lists in theme_data.dart are supposed to be in the same order (for our own sanity). If you're going to categorize the theme data properties, it would be helpful to highlight the ones whose lifetime is limited per flutter.dev/go/material-theme-system-updates and the upcoming move to Material 3. That said, if you'd really like to improve the readability of this file, go for it. |
I'm torn between my laziness and love for neatness. I think I'll do just categorization and forgo alphabetization |
@HansMuller I went ahead and did the whole thing. Don't ever make me do that again (kidding) @rami-a Can you provide color (ha) into which color properties–if any–will be repurposed for material 3? #89852 Also, I'll add tests for |
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
@guidezpl, sorry I didn't catch this sooner. I thought you were just updating the parameters to the default constructor. I was also working in this area with #91774 which will now likely conflict with anything you do in the rest of the file. We should coordinate so we don't step on each others changes. As for which colors will be repurposed for M3, none of the top level color parameters in the |
Np, please merge your change first, it'll easier for me to merge it into mine afterwards. That was my understanding as well, sounds good. |
Will do. Unfortunately there was a revert on master that is causing a merge issue for my PR. Once I get that sorted out I will land it this morning. |
I noticed that @HansMuller I'm running into a failed test for the backwards compatibility for deprecated buttons' highlight color. e.g. In |
The line you're referring to was added about 3 years ago (https://github.com/flutter/flutter/pull/22013/files#diff-7ba6209c92d2c9f5eaedb3ae9336f9c7049aedff35e18c697150a64317fd79e7R31) and I don't think I can offer an explanation for that. I assume that something is slightly out of order WRT the ThemeData initializations, but couldn't tell you more without really digging in. |
Thanks, fixed that. Good to review |
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.
LGTM
This definitely improves readability.
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.
LGTM as well. This was a tedious task, thanks for taking it on.
Wow, thanks @guidezpl! For us that reads ThemeData a lot this is really useful and nice! 💙 |
This reverts commit 78689d3.
I was trying to make sense of the
ThemeData
class and thought it could be improved with some categorisation of parameters and alphabetical sorting.platform
defining defaults fortypography
andmaterialTapTargetSize
This should help future additions and deprecations, while making it easier for developers to inspect and understand.
Related issues
#91772
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.