popup_menu_2 logo

Lightweight and customizable Flutter popup menus designed to keep user attention on the current context.

pub package pub likes pub points platform

GitHub stars GitHub issues GitHub license GitHub last commit

Build status

🌐 Watch the demo web release  |  📦 Download the latest APK

This is a fork of popup_menu by @chinabrant

✨ Highlights

  • Context-aware popup positioning.
  • Supports both tap and long-press triggers.
  • Grid-style menu with configurable columns.
  • Dismiss-on-click-away behavior.
  • Works across Flutter-supported platforms.

📸 Preview

popup preview 3 popup preview 2 popup preview 1

📦 Installation

Add dependency to your pubspec.yaml:

dependencies:
    popup_menu_2: ^0.1.6

Then run:

flutter pub get

🚀 Quick Start

ContextualMenu

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

final GlobalKey targetKey = GlobalKey();

ContextualMenu(
    targetWidgetKey: targetKey,
    maxColumns: 2,
    dismissOnClickAway: true,
    backgroundColor: Colors.black87,
    items: [
        ContextPopupMenuItem(
            onTap: () async {},
            child: const Icon(Icons.add, color: Colors.white),
        ),
        ContextPopupMenuItem(
            onTap: () async {},
            child: const Icon(Icons.remove, color: Colors.white),
        ),
    ],
    child: Icon(Icons.more_vert, key: targetKey),
)

CustomPopupMenu + Controller

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

final controller = CustomPopupMenuController();

CustomPopupMenu(
    controller: controller,
    pressType: PressType.singleClick,
    menuBuilder: () => Container(
        padding: const EdgeInsets.all(12),
        decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(12),
        ),
        child: const Text('Hello from popup_menu_2'),
    ),
    child: const Icon(Icons.touch_app),
)

⚙️ Core Options

  • ContextualMenu: maxColumns, dismissOnClickAway, position, backgroundColor, highlightColor, lineColor.
  • CustomPopupMenu: pressType, showArrow, arrowColor, barrierColor, position, menuOnChange, enablePassEvent.

📄 License

Distributed under the BSD 3-Clause license. See LICENSE.

🔗 More Packages


👨‍💻 Developer Card

Younes M'rabti avatar

Younes M'rabti

📧 Email: admin@youmti.net
🌐 Website: youmti.net
💼 LinkedIn: younesmrabti1996

Libraries

contextual_menu
platform_config\default
platform_config\platform_config
platform_config\platform_export
platform_config\web
A highly customizable popup menu plugin for Flutter.
triangle_painter