Repository navigation
Custom Padding in PopupMenuButton #57110
Copy link
Copy link
Labels
a: annoyanceRepeatedly frustrating issues with non-experimental functionalityRepeatedly frustrating issues with non-experimental functionalitya: qualityA truly polished experienceA truly polished experiencec: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Fluttercustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Not able to configure padding in PopupMenuButton. It is seems like it using the default values for vertical and horizontal paddings,
const double _kMenuCloseIntervalEnd = 2.0 / 3.0;
const double _kMenuHorizontalPadding = 16.0;
const double _kMenuDividerHeight = 16.0;
const double _kMenuMaxWidth = 5.0 * _kMenuWidthStep;
const double _kMenuMinWidth = 2.0 * _kMenuWidthStep;
const double _kMenuVerticalPadding = 8.0;
const double _kMenuWidthStep = 56.0;
const double _kMenuScreenPadding = 8.0;
Flutter 1.17.0 • channel beta • https://github.com/flutter/flutter.git
Framework • revision e6b34c2 (11 days ago) • 2020-05-02 11:39:18 -0700
Engine • revision 540786dd51
Tools • Dart 2.8.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
a: annoyanceRepeatedly frustrating issues with non-experimental functionalityRepeatedly frustrating issues with non-experimental functionalitya: qualityA truly polished experienceA truly polished experiencec: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Fluttercustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Activity
[-]Padding in PopupMenuButton[/-][+]Custom Padding in PopupMenuButton[/+]LucaIaconelli commentedon Aug 1, 2020
It would be fantastic to be able to change this value (_kMenuHorizontalPadding) so that you have the option to remove the padding.
xJon commentedon Oct 19, 2020
Would be a useful feature.
rydmike commentedon Feb 22, 2021
Plus one for this issue. 👍🏻
I just searched for how to remove and change these as well and landed here. Particularly I wanted to get rid of of the top and bottom padding on the popup menu.
This use case example with a long press on a widget context menu, with rounded corners and slightly transparent background, eg as a cut / copy / paste context menu. Would have looked much nicer and compacter without the extra padding on top and bottom. Being able to remove them would have enabled having the padding just a part of the the item height, so when selecting top and bottom items, the highlighte selection and splash would have included the rounded shape border, but nope, no can do, not with this widget.
Parameters like this should be part of
PopupMenuThemeDataand as properties in the Widget.Material still does not always want to work with you, when you want a slightly different design. I know, back to making totally custom widgets or forking this one, just don't always have time for it, this will have to do for now, the look is acceptable for now for my use case, but it could have been even prettier.
Pity to see an issue like these open for this long, it was reported in May 2020.
cc: @HansMuller @mariamhas
Moluram commentedon May 4, 2021
@pedromassangocode Hello! Can I take this issue?
pedromassangocode commentedon May 5, 2021
Hi @Moluram of course :)
I will assign it to you.
github-actions commentedon Jan 31, 2022
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.Make popup menu hardcoded padding configurable (#150506)
Make popup menu hardcoded padding configurable (flutter#150506)
Make popup menu hardcoded padding configurable (#150506)