-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Update Radio button to material 3 #111774
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
Conversation
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.
Shouldn't we check for MaterialState.selected first as in overlayColor since there's 2 sets of tokens for unselected and selected?
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.
Yes, selected is handled before unselected here. The order here is firstly checking disabled states, then selected, then unselected in pressed/hovered/focused states. If the button is disabled, both selected and unselected states return a same value for the fillColor, so I only put a unselected.icon token in disabled condition.
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 meant to say, for example, that while we're handling the disabled unselected case, we're not handling the disabled case. Same goes for other selected states. overlayColor handles these states correctly.
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.
When the button is disabled, both selected and unselected tokens map to same value (color), so I only used the md.comp.radio-button.disabled.unselected.icon here for both selected and unselected cases. Should we handle each condition even if they have same values, or we can update them later only if the tokens become different?
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.
While we haven't been doing this in a disciplined way, if it is easy to support driving this from the tokens (even if the current tokens result in the same values), then we should probably do so.
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 see. Fixing it. Thanks!
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.
We should use tokens as if they were different, which they may be in future updates.
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.
Sure. Fixed it. Thanks!
darrenaustin
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. Thx.
197ceb3 to
01ebde7
Compare
HansMuller
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: #91605
Updated the
Radiowidget with support for Material Design 3.In order to use the
Radiowith the new Material 3 defaults, turn on theuseMaterial3flag in theThemeData:Fixes: #111450
Pre-launch Checklist
///).