Fix chip label not vertically aligned when using sub themes. - #279
Open
davidmartos96 wants to merge 3 commits into
Open
Fix chip label not vertically aligned when using sub themes.#279davidmartos96 wants to merge 3 commits into
davidmartos96 wants to merge 3 commits into
Conversation
Author
|
@rydmike Hello Mike! |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #305
Hello!
After upgrading to v8 I noticed that text chips were not aligned vertically.
After investigation it turned out to be that the following text style wasn't using the
leadingDistributionas.evenandtextBaselineas.alphabetic.flex_color_scheme/lib/src/flex_sub_themes.dart
Line 1995 in bbae097
Those properties come from the typography text theme geometry, and Flutter applies those styles when doing Theme.of(context), and inside
ThemeData.localizeis called.The
englishLiketextTheme in the typography contains those properties.The fix I propose is basically doing the same
TextStyle.mergethat Flutter does when callingTheme.of(context).Theme.of(context)
https://github.com/flutter/flutter/blob/f6ff1529fd6d8af5f706051d9251ac9231c83407/packages/flutter/lib/src/material/theme.dart#L139
ThemeData.localize
https://github.com/flutter/flutter/blob/f6ff1529fd6d8af5f706051d9251ac9231c83407/packages/flutter/lib/src/material/theme_data.dart#L1763-L1766
To reproduce the issue you can try the following code with and without
subThemesData. Hot reload won't work here, you need to hot restart to see the actual difference.Before
After
This also automatically fixes the chip label fontWeight not using w500, which was forgotten in the copyWith linked above.
