showMenus method

Widget showMenus(
  1. List<PopupMenuEntry<int>> items
)

Shows a popup menu where the user taps; items return their int value. child.showMenus([PopupMenuItem(value: 1, child: Text("Edit"))])

Implementation

Widget showMenus(List<PopupMenuEntry<int>> items) => GestureDetector(
  onTapDown: (TapDownDetails details) async {
    final Size screenSize = MediaQuery.of(navigatorKey.currentContext!).size;
    final Offset p = details.globalPosition;
    await showMenu<int>(
      context: navigatorKey.currentContext!,
      position: RelativeRect.fromLTRB(p.dx, p.dy, screenSize.width - p.dx, screenSize.height - p.dy),
      items: items,
    );
  },
  child: this,
);