show method

PopupMenuButton show(
  1. StateMVC<StatefulWidget> state, {
  2. String? applicationName,
  3. Widget? applicationIcon,
  4. String? applicationLegalese,
  5. List<Widget>? children,
  6. bool useRootNavigator = true,
  7. Menu? menu,
})

Implementation

PopupMenuButton<dynamic> show(
  StateMVC state, {
  String? applicationName,
  Widget? applicationIcon,
  String? applicationLegalese,
  List<Widget>? children,
  bool useRootNavigator = true,
  Menu? menu,
}) {
  _state = state;
  _menu = menu;
  _applicationName = applicationName;
  _applicationVersion = 'version: ${App.version} build: ${App.buildNumber}';
  _applicationIcon = applicationIcon;
  _applicationLegalese = applicationLegalese;
  _children = children;

  var menuItems = <PopupMenuEntry<dynamic>>[
//      PopupMenuItem<dynamic>(value: 'Color', child: I10n.t('Colour Theme')),
    PopupMenuItem<dynamic>(value: 'About', child: I10n.t('About'))
  ];

  if (_menu != null) {
    final temp = <PopupMenuEntry<dynamic>>[
      ..._menu!.menuItems(),
      const PopupMenuDivider(),
      ...menuItems
    ];
    menuItems = temp;

    if (_menu!.tailItems.isNotEmpty) {
      menuItems.add(const PopupMenuDivider());
      menuItems.addAll(_menu!.tailItems);
    }
  }

  return PopupMenuButton<dynamic>(
    onSelected: _showMenuSelection,
    itemBuilder: (BuildContext context) => menuItems,
  );
}