popup_menu_2 0.1.5 copy "popup_menu_2: ^0.1.5" to clipboard
popup_menu_2: ^0.1.5 copied to clipboard

A popup menu containing clickable buttons, each with a global click function referring to the item. This is designed to avoid breaking the user's attention.

popup_menu_2 #

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

pub package likes platform license

✨ 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 1 popup preview 2

📦 Installation #

Add dependency to your pubspec.yaml:

dependencies:
    popup_menu_2: ^0.1.5

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

15
likes
130
points
126
downloads

Publisher

verified publisheryoumti.net

Weekly Downloads

A popup menu containing clickable buttons, each with a global click function referring to the item. This is designed to avoid breaking the user's attention.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

cupertino_icons, flutter

More

Packages that depend on popup_menu_2