-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix buttons with icons ignore provided foregroundColor
#162880
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
Fix buttons with icons ignore provided foregroundColor
#162880
Conversation
277be39 to
b58e85e
Compare
|
Related #161467 |
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:) Thanks for the fix!
| /// [ButtonStyle.iconColor] and [iconSize] is used to construct | ||
| /// [ButtonStyle.iconSize]. | ||
| /// | ||
| /// If [foregroundColor] is provided and [iconColor] is not provided, then the button icon will |
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.
Maybe something like: If [iconColor] is null, the button icon will use [foregroundColor]. If [foregroundColor] is also null, the button icon will use the default icon color.
3d044e3 to
cd0e466
Compare
…163201) This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request) Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request. ### Issue Link: What is the link to the issue this cherry-pick is addressing? PR: #162880 Issue: #162839 ### Changelog Description: Explain this cherry pick in one line that is accessible to most Flutter developers. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples Fixes buttons with icons ignore `foregroundColor`. ### Impact Description: What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch) It impacts how buttons with icons render color when using `foregroundColor`. ### Workaround: Is there a workaround for this issue? Provide additional property such as `iconColor` along with `foregroundColor` to match colors for button label and icon. ### Risk: What is the risk level of this cherry-pick? ### Test Coverage: Are you confident that your fix is well-tested by automated tests? ### Validation Steps: What are the steps to validate that this fix works? Testing and samples.
Due to an upstream fix some lines of code could be removed flutter/flutter#162880
Due to an upstream fix some lines of code could be removed flutter/flutter#162880
…#163201) This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request) Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request. ### Issue Link: What is the link to the issue this cherry-pick is addressing? PR: flutter/flutter#162880 Issue: flutter/flutter#162839 ### Changelog Description: Explain this cherry pick in one line that is accessible to most Flutter developers. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples Fixes buttons with icons ignore `foregroundColor`. ### Impact Description: What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch) It impacts how buttons with icons render color when using `foregroundColor`. ### Workaround: Is there a workaround for this issue? Provide additional property such as `iconColor` along with `foregroundColor` to match colors for button label and icon. ### Risk: What is the risk level of this cherry-pick? ### Test Coverage: Are you confident that your fix is well-tested by automated tests? ### Validation Steps: What are the steps to validate that this fix works? Testing and samples.
Extended research with 2+ additional hours of deep analysis across theme properties, widget enhancements, and Material 3 compliance issues. New Issues Documented (Phase 2): - flutter#117755: Divider color inconsistencies M2/M3 (30-45 min, P2, 90%) - flutter#67409: TextField disabled errorText spacing (30-60 min, P2, 85%) Additional Discoveries Added to Tier D: - flutter#162585: SliverAppBar toolbarHeight theme (February 2025!) - flutter#159565: RawWebImage missing properties (P2, web platform) - flutter#159269: Radio fillColor theme (P2, under investigation) - flutter#105887: Divider styling options (dashed/dotted) - flutter#132214: DataTable dividerThickness: 0 bug - flutter#123943: SliverAppBar.medium/large foreground color - And 10+ more viable issues identified Fixed Issues Found During Research: - flutter#131690: ProgressIndicator properties (PR flutter#158104) - flutter#165294: ProgressIndicator strokeWidth adaptive (PR flutter#165370) - flutter#162839: Button icon color regression P1 (PR flutter#162880) Updated Statistics: - 700+ issues scanned (up from 600+) - 90+ issues deeply analyzed (up from 80+) - 180+ search queries (up from 150+) - 140+ categories explored (up from 120+) - 16 MD files with comprehensive documentation - 6+ hours total research time - ~80,000 words of documentation Updated TOP_FLUTTER_ISSUES.md: - Added new Tier A issues (flutter#117755, flutter#67409) - Expanded Tier D with recent discoveries - Updated recommended starting order (11 issues) - Enhanced statistics and insights - Added 10 fixed issues found during research
Fixes Flutter 3.27 and later breaks past styling and theming of icon color on buttons with icons
Description
This PR fixes how the icon color is resolved in
ButtonStyleButton. This was regressed in #143501.Code Sample (taken from issue)
expand to view the code sample
Before
After
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.