Skip to content
pubscout

disable_web_context_menu

1.1.0, released 2 years ago by mariuti.com

Disables the native web context menu for a specific Flutter widget

WASM-ready
$ flutter pub add disable_web_context_menu
Source repository

What it does

Provides a widget that prevents the default browser context menu from appearing when right-clicking a specific child widget on Flutter Web. On non-web platforms, it acts as a pass-through and does nothing.

AI-written summary of version 1.1.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to show a custom Flutter context menu on web for a specific widget instead of the global browser menu.
  • You need your web app to be WASM compatible.

Skip it when

  • You want to disable the context menu globally across the entire app (which can be done via Flutter's built-in BrowserContextMenu).
  • Your app does not target Flutter Web.

Strengths

  • Targeted disabling of context menus for specific widgets rather than globally.
  • Safe to use across all platforms as it safely no-ops on non-web targets.
  • WASM compatible.

Weaknesses

  • Limited to solving a single specific web-only UI problem.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
1
DisableWebContextMenu(
  child: Container(
    width: 200,
    height: 200,
    child: Text('Right click to show custom menu'),
  ),
)

Alternatives

Packages that do the same job and could replace disable_web_context_menu.

Works with

Packages commonly used together with disable_web_context_menu: ones it builds on, ones built on it, and its own family.