[Material] selected/unselected label styles + icon themes on BottomNavigationBar#31018
Merged
johnsonmh merged 14 commits intoflutter:masterfrom May 2, 2019
Merged
Conversation
…ure-bottomNavLabelStyles
rami-a
approved these changes
Apr 16, 2019
Contributor
rami-a
left a comment
There was a problem hiding this comment.
LGTM, just some minor comments
clocksmith
reviewed
Apr 17, 2019
clocksmith
reviewed
Apr 17, 2019
clocksmith
approved these changes
Apr 17, 2019
willlarche
reviewed
Apr 18, 2019
willlarche
reviewed
Apr 18, 2019
willlarche
reviewed
Apr 18, 2019
willlarche
reviewed
Apr 18, 2019
willlarche
reviewed
Apr 18, 2019
willlarche
approved these changes
Apr 18, 2019
rami-a
reviewed
Apr 23, 2019
rami-a
reviewed
Apr 23, 2019
HansMuller
reviewed
Apr 30, 2019
Contributor
HansMuller
left a comment
There was a problem hiding this comment.
I think this could be simplified a little by not doing default value computations in the constructor (at least for the new properties); better to adding "effectiveFoo" getters to _BottomNavigvationBarState
…ure-bottomNavLabelStyles
…ure-bottomNavLabelStyles
9 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds
selectedTextStyleandunselectedTextStyleparameters to theBottomNavigationBarclass. These parameters provide two main benefits to users ofBottomNavigationBar:BottomNavigationBar.Having a generic

TextStyleallows for more than justfontSizeto animate.For example,
TextStyle.fontWeightorTextStyle.fontStylecan animate.Also,

selectedTextStyleandunselectedTextStyleprovide a convenient way to customize thefontFamilyof the text in a bottom nav. Previously, this was only possible by supplying atextStyledirectly to all of the individualTextwidgets passed toBottomNavigationBarItem.selectedTextStyleandunselectedTextStyleparameters will allow for theTextStylesto be customized inBottomNavigationBarTheme, when it is created.This PR also adds
selectedIconThemeandunselectedIconTheme.These params now make bottom navigation bars much more customizable:
Related Issues
N/A
Tests
I added the following tests:
selectedTextStyleandunselectedTextStyleare honored in theBottomNavigationBar.selectedTextStyle.fontSizeandunselectedTextStyle.fontSizetake precedence overselectedFontSizeandunselectedFontSize.selectedTextStyle.colorandunselectedTextStyle.colortake precedence overselectedItemColorandunselectedItemColor.selectedIconTheme.colorandunselectedIconTheme.colortake precedence overselectedItemColorandunselectedItemColor.selectedIconTheme.sizeandunselectedIconTheme.sizetake precedence overiconSize.Alternatives Considered
Since
selectedFontSizeandunselectedFontSizealready exist as parameters, it brings up the question of what to do when bothselectedTextStyle.fontSizeandselectedFontSizeare provided.There are three options I considered:
selectedTextStyle.fontSizeif it is provided, since providing the entireTextStyleis more specific.selectedTextStyleandselectedFontSize.selectedFontSize, since it is now achievable throughselectedFontStyle.fontSize.I opted for option 1, because it is non-breaking and is inline with some existing components. For example, in
TabBars, you could provide bothindicatorColorand anindicatorwith it's own color, and the customindicators color will be used.If we think that having both will serve as unnecessary complication, or that it will be unclear to users which to use, I can deprecate/remove
selectedFontSizeandunselectedFontSizein the future. It would require a breaking change, but it may be worth it.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?