Search packages, repositories and app categories

native_context_menu cover
Package detailsv0.2.2+5

native_context_menu

Provides a native context menu for flutter applications. Most useful on desktop.

macOSWindowsLinux
30-day downloads
5
Likes
107
Pub points
120

Install package

flutter pub add native_context_menu

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The native_context_menu package enables Flutter applications to display platform-native context menus on desktop operating systems. It integrates seamlessly with macOS, Windows, and Linux, providing users with familiar right-click menu experiences that match the system's default behavior. This enhances usability by leveraging OS-level conventions without requiring custom implementations. The package is lightweight and designed specifically for desktop environments where context menus are commonly used.

Use cases

  • Desktop application right-click interactions
  • Enhancing user experience with system-native menus
  • Adding context-sensitive actions in desktop apps
  • Improving accessibility through standard UI patterns
  • Building rich desktop interfaces with minimal code

Key features

  • Platform-native appearance and behavior
  • Support for macOS, Windows, and Linux
  • Minimal setup and integration
  • Automatic handling of system-specific menu styles
  • Seamless with Flutter's widget system

Suitable for

  • Desktop-focused Flutter developers
  • Applications requiring native UX consistency
  • Developers targeting multiple desktop platforms
  • Projects emphasizing user interface fidelity
  • Teams prioritizing cross-platform desktop compatibility

Considerations

  • Not applicable on mobile platforms
  • Limited to desktop use cases
  • Requires platform-specific testing
  • May need additional styling for complex menus
  • Depends on underlying OS menu implementation

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

native_context_menu

Native context menu for flutter apps

lesnitsky.dev GitHub stars Twitter Follow

Preview

Installation

flutter pub add native_context_menu

Usage

import 'package:native_context_menu/native_context_menu.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(App());
}

class App extends StatefulWidget {
  const App({Key? key}) : super(key: key);

  @override
  State<App> createState() => _AppState();
}

class _AppState extends State<App> {
  String? action;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: ContextMenuRegion(
          onDismissed: () => setState(() => action = 'Menu was dismissed'),
          onItemSelected: (item) => setState(() {
            action = '${item.title} was selected';
          }),
          menuItems: [
            MenuItem(title: 'First item'),
            MenuItem(title: 'Second item'),
            MenuItem(
              title: 'Third item with submenu',
              items: [
                MenuItem(title: 'First subitem'),
                MenuItem(title: 'Second subitem'),
                MenuItem(title: 'Third subitem'),
              ],
            ),
            MenuItem(title: 'Fourth item'),
          ],
          child: Card(
            child: Center(
              child: Text(action ?? 'Right click me'),
            ),
          ),
        ),
      ),
    );
  }
}

Platform support

Platform Supported
MacOS ✅
Linux ✅
Windows ✅

License

MIT


lesnitsky.dev GitHub stars Twitter Follow

Categories

Source repository

Projects using this package

No data available yet.