showMenu<T> static method

Future<T?> showMenu<T>({
  1. required BuildContext context,
  2. required RelativeRect position,
  3. required List<PopupMenuEntry<T>> items,
  4. T? initialValue,
  5. double? elevation,
  6. Color? shadowColor,
  7. Color? surfaceTintColor,
  8. String? semanticLabel,
  9. ShapeBorder? shape,
  10. Color? color,
  11. bool useRootNavigator = false,
  12. BoxConstraints? constraints,
  13. Clip clipBehavior = Clip.none,
  14. RouteSettings? routeSettings,
})

Show a popup menu and hide banner while open

Implementation

static Future<T?> showMenu<T>({
  required BuildContext context,
  required RelativeRect position,
  required List<PopupMenuEntry<T>> items,
  T? initialValue,
  double? elevation,
  Color? shadowColor,
  Color? surfaceTintColor,
  String? semanticLabel,
  ShapeBorder? shape,
  Color? color,
  bool useRootNavigator = false,
  BoxConstraints? constraints,
  Clip clipBehavior = Clip.none,
  RouteSettings? routeSettings,
}) async {
  final blocker = _openOverlay();

  try {
    return await material.showMenu<T>(
      context: context,
      position: position,
      items: items,
      initialValue: initialValue,
      elevation: elevation,
      shadowColor: shadowColor,
      surfaceTintColor: surfaceTintColor,
      semanticLabel: semanticLabel,
      shape: shape,
      color: color,
      useRootNavigator: useRootNavigator,
      constraints: constraints,
      clipBehavior: clipBehavior,
      routeSettings: routeSettings,
    );
  } finally {
    _closeOverlay(blocker);
  }
}