-
Notifications
You must be signed in to change notification settings - Fork 590
v1: Added GestureDetector events, error message customization #5802
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
Merged
+1,033
−239
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Introduces a fullscreen_dialog boolean property to the View class, allowing views to be marked as fullscreen modal dialogs.
Removed unused TapDownDetails state in Dart GestureDetector and simplified tap event triggers to not require tap down details. Updated Python GestureDetector to use ControlEventHandler for tap events instead of EventHandler for consistency and improved type safety. Fix #5786
Expanded GestureDetector to support new gesture events including tap move/cancel, secondary/tertiary tap cancel, long press down/cancel/move update/up, secondary/tertiary long press variants, double tap cancel, drag down/cancel, pan down/cancel, and force press events. Updated Dart and Python event mapping, event classes, and control properties to enable richer gesture handling and event data propagation.
Updated file picker examples to use local instances instead of appending to page services. Introduced a State dataclass in pick_and_upload.py for better state management and improved code clarity.
Refactored error handling across Flet backend and Python SDK to use structured logging instead of print/traceback, and to propagate error messages more consistently to the client. Now, errors in before_main and event handlers are logged with stack traces and sent to the session, and session creation is aborted if before_main fails. Also fixed a bug in Dart backend where isLoading was incorrectly set on error.
Introduced the `FletApp.appErrorMessage` template to allow customization of loading screen error messages. Updated error handling to include stack traces for better debugging in Python and Dart backends. Adjusted UI components to use the formatted error message template.
Corrects the key from 'tabs_theme' to 'tab_bar_theme' when parsing the tab bar theme in the parseTheme function, ensuring the correct theme property is used.
Replaced direct assignments to page.window.width and page.window.height with calls to resize_page in integration tests. This improves consistency and maintainability of test setup. Also removed an unused import and updated golden image assets for markdown and snack bar tests.
Replaces 'await flet_app.resize_page(...)' with synchronous 'flet_app.resize_page(...)' in all integration test files. This change reflects an update to the resize_page method, which is now synchronous and no longer requires awaiting.
Introduces the use_ref hook and MutableRef class to allow components to preserve mutable values across renders without causing re-renders. Updates __init__.py to export use_ref.
Added a new declarative audio player example using flet_audio. Updated the shake detector example to store the ShakeDetector instance in the session store instead of appending to services, ensuring a reference is held for session management.
Contributor
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
Deploying flet-docs with
|
| Latest commit: |
80aef5c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://eeed3456.flet-docs.pages.dev |
| Branch Preview URL: | https://v1-fullscreen-dialog-fix.flet-docs.pages.dev |
Created a new documentation page for the use_ref type and added it to the mkdocs navigation under types.
Replaced placeholder 'TBD' docstrings with descriptive explanations for FletApp class attributes, improving code documentation and clarity.
Corrects the use of the 'frozen' parameter in DiffBuilder methods to ensure it is passed through instead of being hardcoded. Adds a test to verify that lists with keys can be updated correctly.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix #5787
Fix #5799
This pull request introduces two main groups of changes: improvements to error message customization in the Flet app loading screen, and a substantial expansion of gesture event handling capabilities in the
GestureDetectorControl. These updates enhance both the user experience during app startup and the range of gestures that can be detected and handled within the app.Error message customization:
FletApp.appErrorMessagetemplate, allowing developers to customize the error message shown on the loading screen when an error occurs. This is reflected in the changelogs and integrated into the app initialization and control state. [1] [2] [3] [4] [5]Gesture detection enhancements:
Greatly expanded the set of gesture events that
GestureDetectorControlcan handle, including new events for tap, double tap, long press, drag, pan, and force press (such asonTapMove,onTapCancel,onDoubleTapCancel,onLongPressMoveUpdate,onHorizontalDragCancel,onForcePressStart, etc.). These events are now properly checked, and their handlers are wired to trigger corresponding control events, enabling much finer-grained gesture interaction. [1] [2] [3] [4] [5] [6]Refactored event handler logic to remove unnecessary storage of
TapDownDetailsand to simplify the triggering of gesture events, ensuring that only the relevant data is passed to event handlers. [1] [2]These changes improve both the flexibility of the app's startup error reporting and the responsiveness and versatility of gesture-based controls.
Summary by Sourcery
Enable customizable startup error messages, expand gesture detection capabilities with fine-grained events, enhance Python error reporting, and introduce a use_ref hook for reusable state in components.
New Features:
Bug Fixes:
Enhancements: