Hi, everyone,
recently i work on creating a popup menu, but seems the default popup menu created by showMenu() function is too wide, it is not what i want.
by tracking the source code, I find the following in popup_menu.dart:
const double _kMenuMaxWidth = 5.0 * _kMenuWidthStep;
const double _kMenuMinWidth = 2.0 * _kMenuWidthStep;
const double _kMenuVerticalPadding = 8.0;
const double _kMenuWidthStep = 56.0;
...
...
class _PopupMenu<T> extends StatelessWidget {
final Widget child = ConstrainedBox(
constraints: const BoxConstraints(
minWidth: _kMenuMinWidth,
maxWidth: _kMenuMaxWidth,
),
...
...
}
it constraints popup menu's min width to
2.0 x 56.0, max width to
5.0 x 56.0.
so if i want to customize popup menu's width outside of the flutter source code, what should I do? if there are any ways to implement this?
btw, why set these constraints to popup menu?