contextMenu<T> method

PopMenu<T> contextMenu<T>({
  1. List<LabelValue<T>>? values,
  2. List<PopupMenuEntry<T>>? items,
  3. PopupMenuItemBuilder<T>? builder,
  4. void onSelected(
    1. T
    )?,
  5. VoidCallback? onCanceled,
  6. T? initialValue,
  7. bool enable = true,
  8. bool popOnTap = false,
  9. bool popOnLongPress = true,
  10. bool popOnRightClick = true,
  11. bool useRootNavigator = true,
  12. Offset offset = Offset.zero,
  13. Color? hoverColor,
  14. 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,
  );
}