π ios_style_context_menu
A Flutter package that brings a beautiful iOS-style context menu to Android.
This menu replicates the iOS long-press interaction behavior and style, allowing users to interact with widgets such as cards, images, or any custom component through a smooth, native-like pop-up menu.
β¨ Features
- π iOS-style interaction β Mimics the native long-press menu behavior on iOS.
- π§° Custom actions β Add any number of actions like Share, Copy, Delete, etc.
- π« Smooth animations β Uses
AnimatedScaleandBackdropFilterfor seamless transitions. - πͺ Blurred background β Optional
BackdropFilterfor a true iOS effect. - π Dark mode ready β Automatically adapts to light/dark themes.
- π§© Fully customizable β Control icon, text, colors, padding, and more.
- π§ Smart delete detection β Automatically highlights delete items in red.
π Getting Started
Add the package to your pubspec.yaml file:
dependencies:
ios_style_context_menu: ^1.0.4
Then run:
flutter pub get
π Usage
Wrap any widget you want with IosStyleContextMenu:
IosStyleContextMenu(
actions: [
ContextMenuAction(
icon: Icons.share,
label: 'Share',
onPressed: () => print('Share tapped'),
),
ContextMenuAction(
icon: Icons.delete,
label: 'Delete',
onPressed: () => print('Delete tapped'),
),
],
child: YourWidgetHere(),
);
πΈ Preview
π¦ Customization Options
| Property | Type | Description |
|---|---|---|
child |
Widget | Required. The widget that triggers the context menu (e.g. image, card, etc.). |
actions |
List | Required. List of context menu actions with icon, label, and onTap callback. |
isDark |
bool? | Optional. Force dark mode (overrides theme). If null, uses system theme. |
textStyle |
TextStyle? | Optional. Custom style for action text (color, font, weight). Supports fallback logic. |
backgroundColor |
Color? | Optional. Background color of the menu container (defaults based on theme with opacity). |
dividerColor |
Color? | Optional. Color of dividers between actions (defaults to light gray or white12). |
iconColor |
Color? | Optional. Default icon color for all actions (auto turns red for destructive actions). |
contentPadding |
EdgeInsetsGeometry? | Optional. Padding for the menu container (defaults to symmetric horizontal padding). |
textSize |
double? | Optional. Text size for menu items. Uses getResponsiveSize() to scale with screen size. |
iconSize |
double? | Optional. Icon size for action icons (currently unused in default widget layout). |
π License
MIT License β see LICENSE file for details.
β€οΈ Author
Developed by Omar Shawkey
Feel free to contribute, open issues, or suggest features!