flutter_context_menu 0.4.0
flutter_context_menu: ^0.4.0 copied to clipboard
Create and display a customizable context menus in your app.
0.4.0 #
Added #
- Support for keyboard shortcuts and trailing widgets in
MenuItem, enabling richer and more flexible menu actions. (closes #33) - Added
SingleActivatorExtensionsfor human-readable shortcut strings (e.g.,"Ctrl+O"). - Added a new
onItemSelectedcallback toContextMenuRegionandshowContextMenufor immediate selection handling.
Changed #
- Renamed
enableGestures→enableDefaultGesturesfor clarity. - Renamed
MenuItem.color→textColorfor clearer meaning. - Updated default
spawnAnchorfor menus and submenus to improve positioning. - Refactored
iconparameter onMenuItemfromIconData?toWidget?to increase flexibility. - Refactored
labelparameter onMenuItemfromStringtoWidgetto increase flexibility. - Updated example project to showcase new features.
Improved #
-
Full generics upgrade:
ContextMenu<T>,ContextMenuItem<T>,ContextMenuEntry<T>, and all related classes are now strongly typed. -
ContextMenu.copyWithnow correctly returnsContextMenu<T>. -
Submenus now use
List<ContextMenuEntry<T>>for strong typing. -
ContextMenuItem.onSelectednow exposes the selected value (ValueChanged<T?>). -
General API consistency improved across widgets and utilities.
-
Significantly improved debugging output:
debugLabelnow includes inherited labels.describeIdentityused for consistent element identification.
-
Extracted
ContextMenuWidgetViewfor cleaner separation of concerns. -
Introduced
kMenuItemHeightconstant for uniform layout behavior inMenuItem. -
Introduced
kMenuItemIconSizeconstant for icon size inMenuItem. -
Added
mediaQueryextension onBuildContextto simplifyMediaQueryaccess.
Fixed #
showContextMenunow uses the root navigator by default, ensuring the menu displays above nested navigators and preventing multiple instances. (Fixes #21)
Removed #
- Removed unused code such as
hasSameFocusNodeId,getScreenRect, andparentMenuKey.
0.3.0 #
Added / Changed #
- feat: A
requestFocusparameter has been added toMenuRouteOptionsand is utilized in theshowMenuhelper function. - Updated
ContextMenuWidget,MenuHeader, andMenuItemto useColor.withValues(). - Minor improvements compatible with Flutter 3.27+.
Breaking Changes #
- Requires Flutter 3.27+ and Dart 3.6+.
- Pubspec environment:
sdk: ^3.6.0 - Not compatible with older Flutter versions (<3.27). Use
0.2.6instead.
Notes #
- This release introduces a new API and may require changes in dependent code.
0.2.6 #
Fixed #
- Replaced
Color.withValues()withcolor.withOpacity()for compatibility with Flutter 3.0–3.26. - Ensured
ContextMenuWidget,MenuHeader, andMenuItemwork on older Flutter versions.
Notes #
- This release is intended for users on Flutter versions below 3.27.
- No new features introduced; only compatibility fixes.
- Pubspec environment:
sdk: '>=3.0.0 <3.6.0'
0.2.5 #
- Refactor: Improve/Fix submenu positioning logic.
- FEAT: Handle long menus properly with scrolling and add example for long menu.
- FEAT: Allow customization of context menu max height.
0.2.4 #
- FIX: enable/disable context menu based on web platform.
0.2.3 #
- Fix context menu is not showing in web (closes #7).
- Add keyboard shortcuts to navigate through the context menu items using the arrow keys (closes #12).
- Fix bug when using
setPathUrlStrategy()in web (closes #17).
0.2.2 #
- Update
README.md. - Update default shortcuts.
- Add generic types to base classes and widgets (closes #3).
- Updated
ContextMenuRegionfor simplified gesture handling. (closes #4) - Updated
ContextMenuRegionto be more customizable with builder. (closes #6) - Fix menu to not auto focus on first item. (closes #11).
- Fix focus bugs.
0.2.1 #
- Add
colorvariable to the context menu item, allowing the item text and icon colors to be customized. - Add
enabledvariable to the context menu item, allowing the item to be disabled if needed. - Add
maybeOf(BuildContext)to the context menu state. - Move
calculateSubmenuPositionto the utils file (lib/src/core/utils.dart). - Some UI changes in the example project.
0.2.0 #
- Removed
providerandequatabledependencies as they are no longer needed. - Updated the package's dependencies to the latest versions.
- Removed unnecessary platform specific folders.
- The package is now fully dependent on InheritedWidget for state management.
- Replaced the old
Overlaywidget with the newOverlayPortalwidget. - Globally applied focus node highlighting and keyboard shortcuts for menu items.
- Added
shortcutsproperty in theContextMenuclass for custom context menu shortcuts.
0.1.3 #
- updated example project.
- added
ContextMenuRegionwidget to show a context menu when a user right-clicks or long-presses on a widget. - improvements and fixes.
- updated
README.md.
0.1.2 #
- added example project.
- added a preview gif to "README" file.
- added
DefaultContextMenuDividerin components. - added
DefaultContextMenuItemin components. - added
DefaultContextMenuTextHeaderin components. - improvements and fixes.
