Add position details to GestureDetector.on_tap event#6016
Merged
FeodorFitsner merged 4 commits intomainfrom Jan 16, 2026
Merged
Add position details to GestureDetector.on_tap event#6016FeodorFitsner merged 4 commits intomainfrom
GestureDetector.on_tap event#6016FeodorFitsner merged 4 commits intomainfrom
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 |
Contributor
There was a problem hiding this comment.
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
reviewed
Jan 16, 2026
ndonkoHenri
approved these changes
Jan 16, 2026
Contributor
ndonkoHenri
left a comment
There was a problem hiding this comment.
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.
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
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 #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: