Skip to main content

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

A powerful, fully customizable iOS-style context menu: smart positioning, fluid animations, drag-to-select, rich submenus (async, paginated) and your own content above the widget.

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
0
points
218
downloads

Publisher

verified publisherthenothingworks.dev

Weekly Downloads

A powerful, fully customizable iOS-style context menu: smart positioning, fluid animations, drag-to-select, rich submenus (async, paginated) and your own content above the widget.

Repository (GitHub)
View/report issues

Topics

#context-menu #menu #popup #overlay #cupertino

License

unknown (license)

Dependencies

flutter, meta

More

Packages that depend on smart_context_menu