showMenu<T> function
Future<T?>
showMenu<T>({
- required BuildContext context,
- required RelativeRect position,
- required List<
PopupMenuEntry< items,T> > - T? initialValue,
- double? elevation,
- String? semanticLabel,
- ShapeBorder? shape,
- Color? color,
- required Duration duration,
- required Curve curve,
Implementation
Future<T?> showMenu<T>({
required BuildContext context,
required RelativeRect position,
required List<PopupMenuEntry<T>> items,
T? initialValue,
double? elevation,
String? semanticLabel,
ShapeBorder? shape,
Color? color,
bool useRootNavigator = false,
Style? menuStyle,
required Duration duration,
required Curve curve,
}) {
assert(items.isNotEmpty);
assert(debugCheckHasMaterialLocalizations(context));
switch (Theme.of(context).platform) {
case TargetPlatform.iOS:
case TargetPlatform.macOS:
break;
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
semanticLabel ??= MaterialLocalizations.of(context).popupMenuLabel;
}
final NavigatorState navigator =
Navigator.of(context, rootNavigator: useRootNavigator);
return navigator.push(_PopupMenuRoute<T>(
position: position,
items: items,
initialValue: initialValue,
semanticLabel: semanticLabel,
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel,
capturedThemes:
InheritedTheme.capture(from: context, to: navigator.context),
menuStyle: menuStyle,
duration: duration,
curve: curve,
));
}