-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix TabBar tab icons not respecting custom IconTheme
#157724
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 TabBar tab icons not respecting custom IconTheme
#157724
Conversation
nate-thegrate
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, with an optional suggestion.
Thanks for making the improvement here!
| // The iconTheme color isn't applied to the selected icon. | ||
| expect(iconStyle(tester, selectedIcon).color, equals(theme.colorScheme.primary)); | ||
| // The iconTheme color is applied to the unselected icon. | ||
| expect(iconStyle(tester, unselectedIcon).color, equals(theme.iconTheme.color)); | ||
|
|
||
| // Both selected and unselected icons should have the iconTheme size. | ||
| expect( | ||
| tester.getSize(find.byIcon(selectedIcon)), | ||
| Size(theme.iconTheme.size!, theme.iconTheme.size!), | ||
| ); | ||
| expect( | ||
| tester.getSize(find.byIcon(unselectedIcon)), | ||
| Size(theme.iconTheme.size!, theme.iconTheme.size!), | ||
| ); |
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 test looks phenomenal ❤️
| MaterialStateColor _resolveWithLabelColor({ | ||
| required BuildContext context, | ||
| IconThemeData? iconTheme, | ||
| }) { |
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.
nit: could we make the build context a positional arg?
| MaterialStateColor _resolveWithLabelColor({ | |
| required BuildContext context, | |
| IconThemeData? iconTheme, | |
| }) { | |
| MaterialStateColor _resolveWithLabelColor( | |
| BuildContext context, { | |
| IconThemeData? iconTheme, | |
| }) { |
It would reduce verbosity and would be consistent with methods like InheritedModel.inheritFrom and Navigator.of.
Not a strong preference though :)
e703080 to
9d7cf72
Compare
|
Reported the weird bot label issue on Discord. |
flutter/flutter@3fb95c7...42132e8 2024-10-29 [email protected] Reland "Upgrade tests to AGP 8.7/Gradle 8.10.2/Kotlin 1.8.10" (flutter/flutter#157617) 2024-10-29 [email protected] [impeller] re-enable impeller shard. (flutter/flutter#157806) 2024-10-29 [email protected] Roll Flutter Engine from 4cb4478016b5 to 725c8e4bc379 (1 revision) (flutter/flutter#157808) 2024-10-29 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Avoid labeling 'context' PRs as 'text-input' (#157650)" (flutter/flutter#157812) 2024-10-29 [email protected] Roll Flutter Engine from b95da8106b98 to 4cb4478016b5 (1 revision) (flutter/flutter#157792) 2024-10-29 [email protected] Remove unused import from kt plugin template (flutter/flutter#157220) 2024-10-29 [email protected] Roll Flutter Engine from 5fa7a123b14a to b95da8106b98 (1 revision) (flutter/flutter#157787) 2024-10-29 [email protected] Fix `TabBar` tab icons not respecting custom `IconTheme` (flutter/flutter#157724) 2024-10-29 [email protected] Roll Flutter Engine from 0c8f0bf4d740 to 5fa7a123b14a (1 revision) (flutter/flutter#157780) 2024-10-29 [email protected] Allow customizing entry mode icons in TimePicker (flutter/flutter#157151) 2024-10-29 [email protected] Add test for `focus_scope.0.dart` (flutter/flutter#157772) 2024-10-29 [email protected] Add test for `page_storage.0.dart` (flutter/flutter#157770) 2024-10-29 [email protected] Roll Flutter Engine from c05af6f939fc to 0c8f0bf4d740 (1 revision) (flutter/flutter#157774) 2024-10-29 [email protected] Roll Flutter Engine from b394e0c98fa0 to c05af6f939fc (1 revision) (flutter/flutter#157767) 2024-10-29 [email protected] Add test for `nested_scroll_view_state.0.dart` (flutter/flutter#157714) 2024-10-29 [email protected] Pin Mac tool_integration_test shards to arm64 (flutter/flutter#157760) 2024-10-29 [email protected] Roll Flutter Engine from ed587dcf61fd to b394e0c98fa0 (4 revisions) (flutter/flutter#157766) 2024-10-28 [email protected] Roll Flutter Engine from 70671baabbba to ed587dcf61fd (10 revisions) (flutter/flutter#157751) 2024-10-28 [email protected] Roll Flutter Engine from 23b2c6d3b3b1 to 70671baabbba (1 revision) (flutter/flutter#157740) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Fixes TabBar ignores Theme's iconTheme.size
Description
When
ThemeData.IconThemewith color and size, is provided, it can override the defaultTabicon color and size.Code sample
expand to view the code sample
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.