-
Notifications
You must be signed in to change notification settings - Fork 589
feat: ContextMenu control
#5761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…en`, and update docs/examples accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've reviewed this pull request using the Sourcery rules engine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new ContextMenu control to the Flet framework, allowing developers to display custom context menus on mouse interactions. The implementation includes support for different mouse buttons (primary, secondary, tertiary), configurable trigger modes (down, long press), and programmatic menu opening.
- Adds
ContextMenucontrol with support for mouse button-specific menus and triggers - Refactors popup menu building logic into a shared utility function
- Updates documentation with improved formatting and consistency across multiple files
Reviewed Changes
Copilot reviewed 26 out of 31 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
sdk/python/packages/flet/src/flet/controls/material/context_menu.py |
New control implementation with event classes and trigger modes |
packages/flet/lib/src/controls/context_menu.dart |
Flutter implementation handling gesture detection and menu display |
packages/flet/lib/src/utils/popup_menu.dart |
Extracted shared popup menu building logic |
packages/flet/lib/src/controls/popup_menu_button.dart |
Refactored to use shared popup menu utility |
sdk/python/packages/flet/src/flet/__init__.py |
Exports for new ContextMenu classes |
sdk/python/packages/flet/mkdocs.yml |
Documentation configuration entries |
| Various test and example files | Integration tests and usage examples |
| Documentation files | Improved formatting and consistency in docstrings |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sdk/python/packages/flet/src/flet/controls/material/context_menu.py
Outdated
Show resolved
Hide resolved
Deploying flet-docs with
|
| Latest commit: |
0be6055
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://4e1dd58b.flet-docs.pages.dev |
| Branch Preview URL: | https://context-menu-popup.flet-docs.pages.dev |
Fix #1804
Example
Summary by Sourcery
Implement a full‐featured ContextMenu control in Flet with multi‐button triggers, event handling, and programmatic API, while refactoring popup menu entry logic, standardizing documentation code samples, and adding relevant docs and integration tests.
New Features:
Enhancements:
Documentation:
Tests: