Back to Projects
Flutter PackagesActive

Flutter Root Context Menu

A customizable context menu package for Flutter with animation support and flexible styling

dartflutter

Pub Version License

Overview

Flutter Root Context Menu is a package that brings web-like context menus (right-click menus) to Flutter applications. It goes beyond what Flutter's built-in showMenu or PopupMenuButton can offer by providing precise position control, multiple animation options, and custom widget items — delivering a native-quality context menu experience for desktop and web environments.

Key Features

  • Manual trigger control: Use showRootContextMenu() to display menus at any position and timing
  • 8 built-in animations: popup, fade, slideUp, slideDown, slideRight, bounce, scale, none + custom animation support
  • Custom widget items: Place interactive widgets like Switch, Checkbox, and Slider inside menu items using ContextMenuItem.custom()
  • Flexible styling: Fine-grained customization of background color, hover color, border radius, shadows, item spacing, and more
  • Smart positioning: Automatic overflow prevention that keeps menus within screen boundaries
  • Area constraints: Restrict where menus can appear using ContextMenuArea
  • Auto-close on route changes: ContextMenuRouteObserver automatically cleans up menus on navigation
  • Async callback support: Safely handle async operations in onTap callbacks

Supported Platforms

Android, iOS, Web, macOS, Windows, Linux

Technical Highlights

  • Overlay-based rendering: Menus are inserted into the top-level Overlay, ensuring they render correctly above any widget regardless of parent clipBehavior or overflow settings.
  • Zero external dependencies: Relies only on the Flutter SDK with no third-party packages, keeping your dependency tree clean.
  • Web-friendly click behavior: Clicking outside the menu closes it and passes the click event through to the underlying widget in a single action — no double-click needed.
  • Custom animation extensibility: Beyond the built-in animations, the AnimationBuilder type lets you define entirely custom animation logic for maximum flexibility.

Why It Stands Out

Implementing context menus in Flutter typically means either using showMenu with limited customization or manually managing Overlay entries with significant boilerplate. Flutter Root Context Menu bridges this gap — a single function call produces a fully animated, stylish context menu.

Its zero-dependency approach eliminates concerns about package conflicts when adopting the library. The custom() builder, which supports interactive widgets like Switch and Checkbox as menu items, is particularly valuable for real-world scenarios like settings panels or filter menus. If you're building a desktop or web Flutter application that needs native-quality context menu UX, this package is worth considering.

Comments