contextMenu<T> method
PopMenu<T>
contextMenu<T>({
- List<
LabelValue< ? values,T> > - List<
PopupMenuEntry< ? items,T> > - PopupMenuItemBuilder<
T> ? builder, - void onSelected(
- T
- VoidCallback? onCanceled,
- T? initialValue,
- bool enable = true,
- bool popOnTap = false,
- bool popOnLongPress = true,
- bool popOnRightClick = true,
- Offset offset = Offset.zero,
- Color? hoverColor,
- double? borderRadius = 3,
Implementation
PopMenu<T> contextMenu<T>({
List<LabelValue<T>>? values,
List<PopupMenuEntry<T>>? items,
PopupMenuItemBuilder<T>? builder,
void Function(T)? onSelected,
VoidCallback? onCanceled,
T? initialValue,
bool enable = true,
bool popOnTap = false,
bool popOnLongPress = true,
bool popOnRightClick = true,
bool useRootNavigator = true,
Offset offset = Offset.zero,
Color? hoverColor,
double? borderRadius = 3,
}) {
PopupMenuItemBuilder<T> b;
if (builder != null) {
b = builder;
} else if (items != null) {
b = (c) => items;
} else if (values != null) {
b = (c) => values.mapList((e) => PopupMenuItem<T>(child: e.label.text(), value: e.value));
} else {
b = (c) => [];
}
return PopMenu(
child: this,
builder: b,
onSelected: onSelected,
onCanceled: onCanceled,
initialValue: initialValue,
enable: enable,
popOnTap: popOnTap,
popOnLongPress: popOnLongPress,
popOnRightClick: popOnRightClick,
useRootNavigator: useRootNavigator,
offset: offset,
hoverColor: hoverColor,
borderRadius: borderRadius,
);
}