'Change Flutter PopupMenu size
I have a nav bar on a Flutter web app which I am using PopupMenuButton for the menu. I have been able to make the menu smaller by wrapping the PopupMenuItem's child in a Container with a set width, but have not seen the same result when I try to make the Container bigger.
PopupMenuButton(
itemBuilder: (context) => [
for (Map item in menuItems)
PopupMenuItem(child: menuItem(item))
],
SMALL CONTAINER
The code
Widget menuItem(data) {
return Container(
width: 100,
child: Column(...)
);
}
LARGE CONTAINER
The code
Widget menuItem(data) {
return Container(
width: 900,
child: Column(...)
);
}
NO CONTAINER
The code
Widget menuItem(data) {
return Column(...)
}
I want the menu to be as large as possible. PS - menuItems is a list of maps with String and Icons
Solution 1:[1]
this is currently same situation that i'm facing on. So the idea is wrapping the item with a Container which has width with Media Query like this.
PopupMenuItem(
child: Container(
width: MediaQuery.of(context).size.width * 0.2,
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dharman |



