-
Notifications
You must be signed in to change notification settings - Fork 611
Add position details to GestureDetector.on_tap event
#6016
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
Pass TapDownDetails to the 'tap' event in the Dart GestureDetector implementation and update the Python type annotation for on_tap to use EventHandler[TapEvent[GestureDetector]]. This improves event data consistency and type safety.
Deploying flet-examples with
|
| Latest commit: |
e1bdb2a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9d995f1a.flet-examples.pages.dev |
| Branch Preview URL: | https://on-tap-event-coords.flet-examples.pages.dev |
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 adds position details (local and global coordinates, device kind) to the on_tap event in the GestureDetector control. Previously, the on_tap event provided no position information, making it inconsistent with other tap events like on_tap_down and on_tap_up.
Changes:
- Modified Dart implementation to capture and pass TapDownDetails to the tap event
- Updated Python type annotation from
ControlEventHandlertoEventHandler[TapEvent["GestureDetector"]]for type consistency
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| sdk/python/packages/flet/src/flet/controls/core/gesture_detector.py | Updated type annotation for on_tap to use TapEvent type for improved type safety |
| packages/flet/lib/src/controls/gesture_detector.dart | Added state variable to store TapDownDetails and modified event handlers to capture and pass position data to tap event |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Replaces bitwise OR '|' with logical OR '||' in the onTapDown condition to ensure correct evaluation of gesture callbacks.
Deleted packages/flet/CHANGELOG.md and updated the main CHANGELOG.md. Updated the README and pubspec.yaml in packages/flet to reflect these changes.
ndonkoHenri
left a comment
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.
lgtm - let me have your thoughts on changelog comment
Removed the symlink to ../../CHANGELOG.md in packages/flet/CHANGELOG.md and replaced it with a full copy of the changelog content. This change ensures the changelog is directly available within the package directory.
Fix #6015
Pass TapDownDetails to the 'tap' event in the Dart GestureDetector implementation and update the Python type annotation for on_tap to use EventHandler[TapEvent[GestureDetector]]. This improves event data consistency and type safety.
Summary by Sourcery
Include tap position details in GestureDetector tap events and align Python type annotations with the richer tap event data.
New Features:
Enhancements: