Remove padding from PopupMenuItem (overflow menu)

enter image description here

In my case I had to remove the fixed padding of 8 which moves all my components to the side and is not nice. For this I have created a workaround that works in my case. As I am working on a Row, this was enough for me:

ConstrainedBox constrainedBoxPopup =  new ConstrainedBox(
      constraints: new BoxConstraints(
        maxHeight: 30.0,
        maxWidth: 30.0,
     ),
      child: popupMenuButton,
  );

As you can see I have forced a maximum height and width in a ConstrainedBox. In fact, the padding has no effect on it now.


I don't like it but this is the only solution that worked for me. I had to edit non project files (PopupMenuItem class)

return InkWell(
      onTap: widget.enabled ? handleTap : null,
      child: Container(
        height: widget.height,
        padding: const EdgeInsets.symmetric(horizontal: _kMenuHorizontalPadding), // setting this to 0 worked 
        child: item,
      ),
    );

PS: I hope someone will come up with better answer. And I will be glad to accept it. Thanks :)

Tags:

Dart

Flutter