-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add ToggleButtons.textStyle property #38813
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 ToggleButtons.textStyle property #38813
Conversation
willlarche
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.
Thank you!
| this.borderWidth, | ||
| }); | ||
|
|
||
| /// The [TextStyle] to apply to any text that appears in this button. |
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 really the default text style for the ToggleButtons' [children], since a ToggleButtons' child like Text('foo', style: bar), still wins the text style.
| ); | ||
|
|
||
| TextStyle textStyle; | ||
| textStyle = tester.firstWidget<DefaultTextStyle>( |
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.
Is "firstWidget" really needed here (and elsewhere)?
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 -- There are two Material widgets in this test -- The one explicitly instantiated and another one by RawMaterialButton, which is used to create each toggle button.
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.
Discussed offline and updated these finders to be more specific and easier to read
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
Description
Allows developers to apply a
TextStyleto theToggleButtonsthrough theToggleButtons.textStyleor theToggleButtonsTheme.textStyleproperties.TextStyle.coloris ignored to preserve the active/selected/disabled color states.cc/ @lisa-liao
Code snippet (note that color is specified)
Result (note that color is ignored)
Related Issues
Fixes #38661
Tests
I added the following tests:
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?