contextmenu 1.0.1 copy "contextmenu: ^1.0.1" to clipboard
contextmenu: ^1.0.1 copied to clipboard

outdated

Display a beautifully animated, material context menu using pure Flutter

contextmenu #

Gitlab pipeline status Pub Version

Display a beautiful material context menu using pure Flutter.

It works both on touch devices and on desktop devices.

See a demo here!

Features #

  • modern, emphasizing animation according to material design guidelines
  • handles screen edges and oversize

Getting Started #

You can easily display a context menu using the following code:

Widget build() {
  return ContextMenuArea(
    items: [
      ListTile(
        title: Text('Option 1'),
        onTap: () {
          Navigator.of(context).pop();
          ScaffoldMessenger.of(context)
              .showSnackBar(SnackBar(content: Text('Whatever')));
        },
      )
    ],
    child: Card(
      color: Theme
          .of(context)
          .primaryColor,
      child: Center(
        child: Text('Press somewhere for context menu.'),
      ),
    ),
  );
}

A more complicated way manually triggering a context menu using showContextMenu() is:

Widget build() {
  return GestureDetector(
    onSecondaryTapDown: (details) => showContextMenu(
        details.globalPosition, context, items, verticalPadding, width),
    child: Text('Tap!'));
}

Setup web #

For the web, edit your index.html and add the following in the <body> tag:

<body oncontextmenu="return false;">

License #

This project is EUPL licensed. For further details, consult LICENSE.

88
likes
40
pub points
95%
popularity

Publisher

verified publisherwith-the-braid.cf

Display a beautifully animated, material context menu using pure Flutter

Homepage
Repository (GitLab)
View/report issues

License

EUPL-1.2 (LICENSE)

Dependencies

after_layout, animations, flutter

More

Packages that depend on contextmenu