-
Notifications
You must be signed in to change notification settings - Fork 28.5k
Refactor ToggleButtons
(remove RawMaterialButton
)
#99493
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 ToggleButtons
(remove RawMaterialButton
)
#99493
Conversation
8058dd0
to
2f79f04
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.
NICE - all of the existing golden file tests pass! 🎉 (There are only two, but still, that's great)
Comparing this to the same refactor you are doing for FAB (#99753)
- FAB is not becoming a
ButtonStyleButton
, but here it looks likeToggleButtons
are. - FAB is not going to have a
ButtonStyle style
parameter like here, instead deferring to its numerated properties and inherited theme to create a ButtonStyle internally. ToggleButtons here allow for style to be set OR individual properties + theming.
I wonder if the FAB approach is cleaner, the style property here on ToggleButtons might not be necessary, but again I will defer to @HansMuller on general design since he wrote the model.
All of this work in FAB & Toggle is really great progress though. Thanks!
We should make sure that this PR also fixes #97302 |
I agree with Kate, this PR shouldn't include the extra step of adding a ButtonStyle |
74a9652
to
4b1618d
Compare
This is now handled by MobileDesktop (Web) |
@TahaTesser - if this PR fixes #97302 it should say so in the PR's description and it should include a regression test (marked as a regression test for #97302 with a comment). |
@TahaTesser - the screenshots in #99493 (comment) imply that the background color for the ToggleButtons isn't clipped to the ToggleButtons' shape? |
@HansMuller
This is just a parent container with color from #97302 ClipRRect still clipping the toggle buttons in this refactor |
@TahaTesser - Good! |
@HansMuller |
9d5b89e
to
4284e86
Compare
@HansMuller Filed #100124, this will land after this PR (tester finders look for |
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.
This is looking good however I don't think the style parameter belongs in this PR; see #99493 (comment)
4284e86
to
21d345d
Compare
My apologies I missed removing that parameter, done. |
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.
@TahaTesser is this ready for another review? Or is it waiting on additional changes like the FAB one?
Hey @Piinks! This |
@TahaTesser - I haven't tested or even compiled the code I've suggested for the _ForegroundColor and _BackgroundColor. If they're difficult let me know and I'll fix them. |
213dfc0
to
9db5792
Compare
This is cleaner, thanks! |
Hey, I think this change is a incorrect. #99493 (comment) does not look like the correct toggle button styling on Mobile. |
@math1man - can you explain what aspect of the component doesn't look correct? |
It's too tall. The standard height I believe is 32 dp, but it looks like 48 dp. |
@TahaTesser - can you investigate? AFAICT we have not changed the geometry of ToggleButtons, however perhaps we've always had this wrong. I don't believe https://m3.material.io/ covers it (yet). |
The failure appears related to #97302, which this closed. Rather than allow for a height of 32, it seems like this enforced a height of 48 - IIRC that is the minimum required size for interactive elements. To reproduce this, the ToggleButtons.constraints were set with a min/max height of 32, but did not adhere to that. |
I also found this in the Material Design components app, I will look into it and test it in an Android native app.
Perhaps there should Android equivalent of https://github.com/flutter/platform_tests/tree/master/ios_widget_catalog_compare |
@Piinks |
@TahaTesser - If a PR is created that relands the ToggleButton refactor, we'll need some additional regression tests to verify that the buttons handle input within 48 vertical without the button's outline occupying 48. |
* 'stable' of https://github.com/flutter/flutter: (1203 commits) 'Update Engine revision to ffe7b86a1e5b5cb63c8385ae1adc759e372ee8f4 for stable release 3.0.3' (flutter#106431) [flutter_releases] Removing minor iOS version filter value from ci.yaml (flutter#105059) (flutter#105629) [flutter_releases] Flutter stable 3.0.2 Framework Cherrypicks (flutter#105528) [framework] ensure ink sparkle is disposed (flutter#104569) (flutter#105144) [CP] Fix Flutter doctor crash on Windows caused by bad UTF8 from vswhere.exe (flutter#105153) [tool][web] Use 'constructor' instead of 'public field declarations' in flutter.js (Safari 13) (flutter#105162) [flutter_releases] Cherrypicks for SliverReorderableList and Slider regressions (flutter#105141) 'Update Engine revision to caaafc5604ee9172293eb84a381be6aadd660317 for stable release 3.0.1' (flutter#104213) [flutter_releases] Flutter stable 2.13.0 Framework Cherrypicks (flutter#103375) [flutter_releases] Flutter beta 2.13.0-0.4.pre Framework Cherrypicks (flutter#103101) Enforce cpu explicitly for Mac devicelab test beds (flutter#101871) (flutter#102685) [flutter_releases] Flutter beta 2.13.0-0.3.pre Framework Cherrypicks (flutter#102620) [flutter_releases] Upgrade dwds to 12.1.1 (flutter#101546) [flutter_releases] Flutter beta 2.13.0-0.2.pre Framework Cherrypicks (flutter#102193) [flutter_releases] Flutter beta 2.12.0-4.1.pre Framework Cherrypicks (flutter#101771) [flutter_releases] Cherrypick engine to c341645 (flutter#101608) Revert "Refactor `ToggleButtons` (remove `RawMaterialButton`) (flutter#99493)" (flutter#101538) [Cherrypick] Partial revert of super params in tools (flutter#101436) (flutter#101527) Roll Engine from e7e7ca1 to b48d65e (10 revisions) (flutter#101370) [flutter_tools] port bash script to use sysctl not uname on macOS (flutter#101308) ...
…flutter#99493)" (flutter#101538)" This reverts commit 02d44bb.
fixes #99085
fixes #97302
minimal code sample
Description
Here this PR refactors
ToggleButtons
and useButtonStyleButton
to styleToggleButtons
highlight color not being translated to ElevatedButton (
ButtonStyleButton
sets highlight color to be transparent).Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.