Skip to main content

smart_context_menu 1.0.3 copy "smart_context_menu: ^1.0.3" to clipboard
smart_context_menu: ^1.0.3 copied to clipboard

A powerful, customizable iOS-style context menu: smart positioning, fluid animations, drag-to-select, submenus (async, paginated), and widgets above the preview (e.g. reactions).

example/example.md

smart_context_menu example #

Long press the bubble to open its menu; Share opens a submenu.

import 'package:flutter/cupertino.dart';
import 'package:smart_context_menu/smart_context_menu.dart';

void main() => runApp(const CupertinoApp(home: MessagePage()));

class MessagePage extends StatelessWidget {
  const MessagePage({super.key});

  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      child: Center(
        child: SmartContextMenu(
          items: [
            SmartContextMenuItem.simple(
              title: 'Copy',
              leading: const Icon(CupertinoIcons.doc_on_doc),
              onTap: () => debugPrint('Copy'),
            ),
            SmartContextMenuItem.submenu(
              title: 'Share',
              leading: const Icon(CupertinoIcons.share),
              children: [
                SmartContextMenuItem.simple(
                  title: 'Messages',
                  onTap: () => debugPrint('Share to Messages'),
                ),
                SmartContextMenuItem.simple(
                  title: 'Mail',
                  onTap: () => debugPrint('Share to Mail'),
                ),
              ],
            ),
            SmartContextMenuItem.separator(),
            SmartContextMenuItem.simple(
              title: 'Delete',
              leading: const Icon(CupertinoIcons.delete),
              isDestructive: true,
              onTap: () => debugPrint('Delete'),
            ),
          ],
          child: Container(
            padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
            decoration: BoxDecoration(
              color: CupertinoColors.activeBlue,
              borderRadius: BorderRadius.circular(18),
            ),
            child: const Text(
              'Long press me',
              style: TextStyle(color: CupertinoColors.white),
            ),
          ),
        ),
      ),
    );
  }
}

The example app has four tabs: Files, Chat, Appearance, and Lab. Run it with flutter run from the example directory. Read the example app README for details, or try the live demo.

11
likes
160
points
218
downloads
screenshot

Documentation

API reference

Publisher

verified publisherthenothingworks.dev

Weekly Downloads

A powerful, customizable iOS-style context menu: smart positioning, fluid animations, drag-to-select, submenus (async, paginated), and widgets above the preview (e.g. reactions).

Repository (GitHub)
View/report issues

Topics

#context-menu #menu #popup #overlay #chat-context-menu

License

MIT (license)

Dependencies

flutter, meta

More

Packages that depend on smart_context_menu