Skip to content
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

Fixed for DropdownButton crashing when a style was used that didn't include a fontSize #33474

Merged
merged 2 commits into from
May 29, 2019

Conversation

darrenaustin
Copy link
Contributor

Description

If the style parameter to a DropdownButton didn't specify a fontSize we weren't falling back and using the fontSize from the theme's subhead. This PR fixes that and adds a test for it.

Related Issues

Fixes: #33425

Tests

I added a test to ensure we don't crash with this configuration.

Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • No, this is not a breaking change.

Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -795,7 +795,8 @@ class _DropdownButtonState<T> extends State<DropdownButton<T>> with WidgetsBindi
// Similarly, we don't reduce the height of the button so much that its icon
// would be clipped.
double get _denseButtonHeight {
return math.max(_textStyle.fontSize, math.max(widget.iconSize, _kDenseButtonHeight));
final double fontSize = _textStyle.fontSize ?? Theme.of(context).textTheme.subhead.fontSize;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a little clearer as: ... widget.style.fontSize ?? Theme.of(context)...

@darrenaustin darrenaustin merged commit 252a14b into flutter:master May 29, 2019
@darrenaustin darrenaustin deleted the dropdown_no_fontsize branch May 29, 2019 20:18
kiku-jw pushed a commit to kiku-jw/flutter that referenced this pull request Jun 14, 2019
…nclude a fontSize (flutter#33474)

Fixed an issue with a DropdownButton crashing when a style was used that didn't include a fontSize.
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
3 participants