-
Notifications
You must be signed in to change notification settings - Fork 29.5k
Add backgroundColor to RadioThemeData
#171326
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
Add backgroundColor to RadioThemeData
#171326
Conversation
| widget.backgroundColor?.resolve(activeStates) ?? | ||
| radioTheme.backgroundColor?.resolve(activeStates) ?? | ||
| Colors.transparent; | ||
| final Color inactiveBackgroundColor = | ||
| widget.backgroundColor?.resolve(inactiveStates) ?? Colors.transparent; | ||
| widget.backgroundColor?.resolve(inactiveStates) ?? | ||
| radioTheme.backgroundColor?.resolve(inactiveStates) ?? | ||
| Colors.transparent; |
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.
I want to bring back the question from #169415 (comment)
I'm not sure how we want to handle those transparent colors? The other properties are using _RadioDefaultsM3 or _RadioDefaultsM2 as a fallbacks.
What is the best thing to do here?
Is this something that could/should be in the Material token database? Or is this ok as-is?
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.
Sorry I missed the conversation over there! Yes, we should add the transparent backgroundColor in the 2 default RadioThemeData. I don't think there's any tokens that specify the background color, so no token will need to be involved.
To add the default value in _RadioDefaultsM2:
we can just go to the class and add it manually.
For _RadioDefaultsM3:
We should go to dev/tools/gen_defaults/lib/radio_template.dart, add the default value for backgroundColor, then run script dev/tools/gen_defaults/bin/gen_defaults.dart in the root. The script will generate default M3 theme Data for us.
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.
Awesome thank you! I added it in Add background Color to defaults
QuncCccccc
left a comment
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! Thank you for your contribution:)!
chunhtai
left a comment
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
Part of flutter#168787 Follow-up of flutter#171204 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Part of #168787
Follow-up of #171204
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.