You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DropdownButtonFormField has additional padding on top and bottom after upgrade to v1.12.13+hotfix.5 #46844
It would help if you could provide a small self-contained app that demonstrates the problem. Note also: https://gist.github.com/ is a useful way to share the code.
@HansMuller Here is the example. If the below example is built against the latest flutter stable version then you'll get this issue. If it is built against the stable version prior to the latest stable then you won't see this issue.
There was recently a change to increase the minimum height of TextFields from 40px to 48px, and that resulted in some changes to InputDecorator, which is used by DropdownButtonFormField. Here is the PR.
If that's the case, if you set InputDecorator's isDense property to true, you should be able to get the original size.
@justinmc would that change have caused this? That was the only thing I could find or think of.
Reacted by Tirth Patel, Dmitry Sikorsky and Nikolay Ivanov
I just tried comparing the size of the dropdown on master vs. after reverting my PR (924e48e), and it was the same size. TextFields did change size, though. That PR seems suspicious, but I don't think it's affecting this.
isDense still might help, but it looks like a real regression.
Edit: Somehow I deleted my original comment, but here it is again:
Thanks for the help. I think I've narrowed it down to #36998. When I revert it, the spacing seems to return to its original state. @sarbagyastha, if you have some time, could you take a look at what might be causing this issue? I plan on looking at it as well, but my first guess would be that some default parameter value was not properly translated
changed the title [-]DropdownButtonFormField looks different after building my app against latest stable flutter. [/-][+]DropdownButtonFormField has additional padding on top and bottom after upgrade to v1.12.13+hotfix.5[/+]on Dec 16, 2019
the 1st field (price) is a common TextField with OutlineInputBorder border;
the 2nd field (unit) is a DropdownButtonFormField with OutlineInputBorder border;
Even with isDense=true there is an extra padding (8 pixes in total: 4 on top, 4 on bottom) between the labelText and the widget that wraps the labelText and the Icon
in dropdown.dart line 1284 there is a method that calculates the height, the result is 24 if I set it to 16 the DropdownButtonFormField render the same height of the TextField, however I think it's not correct to set it as a constant. I can't figure out where this 8 pixels of extra padding were created.
Line 1284 of dropdown.dart.
double get _denseButtonHeight {
final double fontSize =
_textStyle.fontSize ?? Theme.of(context).textTheme.subtitle1.fontSize;
return math.max(fontSize, math.max(widget.iconSize, _kDenseButtonHeight));
}
I am in last stable release of Flutter (Channel stable, v1.17.4)
It seems unlikely that this is due to #59196, but it would be worth ruling out.
@cassioseffrin - please open up a new issue and include a small complete test app that demos the problem. Let us know if the problem exists in the latest version of Flutter. Thanks for the report!
@HansMuller, I don't think it's related to #59196, in this case the Text height is exactly the same. I actually have made a correction in the widget dropdown.dart, just 1 line of code. May I could make a PR?
The problem is the icon size calculation, the resulting height is stretching all the DropdownButtonFormField: see the results, both components are now with exactly the same height.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
HansMuller commentedon Dec 12, 2019
It would help if you could provide a small self-contained app that demonstrates the problem. Note also: https://gist.github.com/ is a useful way to share the code.
gabrielginter commentedon Dec 16, 2019
same issue here, I had to set the contentPadding in the decoration to improve its look, but still have some extra padding that I can't remove.
tirth-aubergine commentedon Dec 16, 2019
@HansMuller Here is the example. If the below example is built against the latest flutter stable version then you'll get this issue. If it is built against the stable version prior to the latest stable then you won't see this issue.
Other example I posted
DropdownButtonFormFieldlooks different after building my app against latest stable flutter.After Upgrading to Flutter v1.12.13+hotfix.5
Before Upgrading to v1.12.13+hotfix.5 (I was using latest stable version prior to v1.12.13+hotfix.5)
shihaohong commentedon Dec 16, 2019
There was recently a change to increase the minimum height of TextFields from 40px to 48px, and that resulted in some changes to
InputDecorator, which is used byDropdownButtonFormField. Here is the PR.If that's the case, if you set InputDecorator's
isDenseproperty to true, you should be able to get the original size.@justinmc would that change have caused this? That was the only thing I could find or think of.
justinmc commentedon Dec 16, 2019
I just tried comparing the size of the dropdown on master vs. after reverting my PR (924e48e), and it was the same size. TextFields did change size, though. That PR seems suspicious, but I don't think it's affecting this.
isDense still might help, but it looks like a real regression.
shihaohong commentedon Dec 16, 2019
Edit: Somehow I deleted my original comment, but here it is again:
Thanks for the help. I think I've narrowed it down to #36998. When I revert it, the spacing seems to return to its original state. @sarbagyastha, if you have some time, could you take a look at what might be causing this issue? I plan on looking at it as well, but my first guess would be that some default parameter value was not properly translated
[-]DropdownButtonFormField looks different after building my app against latest stable flutter. [/-][+]DropdownButtonFormField has additional padding on top and bottom after upgrade to v1.12.13+hotfix.5[/+]shihaohong commentedon Dec 16, 2019
I figured it out --
isDenseused to be true by default for DropdownButtonFormField, but is now false by default.tirth-aubergine commentedon Dec 17, 2019
Thank you @shihaohong, now I understand. 👍 I've observed this change in the master channel a few months back but when I saw it stable I was surprised.
tirth-aubergine commentedon Dec 17, 2019
Thank you @justinmc 👍
cassioseffrin commentedon Jun 30, 2020
@shihaohong take a look:
the 1st field (price) is a common TextField with OutlineInputBorder border;
the 2nd field (unit) is a DropdownButtonFormField with OutlineInputBorder border;
Even with isDense=true there is an extra padding (8 pixes in total: 4 on top, 4 on bottom) between the labelText and the widget that wraps the labelText and the Icon
in dropdown.dart line 1284 there is a method that calculates the height, the result is 24 if I set it to 16 the DropdownButtonFormField render the same height of the TextField, however I think it's not correct to set it as a constant. I can't figure out where this 8 pixels of extra padding were created.
Line 1284 of dropdown.dart.
I am in last stable release of Flutter (Channel stable, v1.17.4)
HansMuller commentedon Jun 30, 2020
It seems unlikely that this is due to #59196, but it would be worth ruling out.
@cassioseffrin - please open up a new issue and include a small complete test app that demos the problem. Let us know if the problem exists in the latest version of Flutter. Thanks for the report!
cassioseffrin commentedon Jun 30, 2020
@HansMuller, I don't think it's related to #59196, in this case the Text height is exactly the same. I actually have made a correction in the widget dropdown.dart, just 1 line of code. May I could make a PR?
The problem is the icon size calculation, the resulting height is stretching all the DropdownButtonFormField: see the results, both components are now with exactly the same height.

Here without debug paint:

HansMuller commentedon Jun 30, 2020
@cassioseffrin - I have opened a new issue for the bug you've reported: #60624. Please add new comments there, since this issue is closed.
cassioseffrin commentedon Jun 30, 2020
Thks for opening the issue @HansMuller, I will continue there!
github-actions commentedon Jul 31, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.