-
Notifications
You must be signed in to change notification settings - Fork 594
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Duplicate Check
- I have searched the opened issues and there are no duplicates
Describe the bug
When I was writing the logic to handle the events thrown by GestureDetector, I found that when I performed a right-click operation, GestureDetector did not generate a TapEvent as described in the documentation, but a regular Event object, which caused my attempts to get the cursor coordinates to fail.
Code sample
Code
import flet as ft
def trigger_open_menu(
event: ft.TapEvent[ft.GestureDetector] | ft.LongPressStartEvent[ft.GestureDetector],
):
print(event)
async def main(page: ft.Page):
# on web, disable default browser context menu
if page.web:
await page.browser_context_menu.disable()
gd = ft.GestureDetector(
on_long_press_start=trigger_open_menu,
on_secondary_tap=trigger_open_menu,
content=ft.ListTile(title=ft.Text("Test"), subtitle=ft.Text("Testing")),
)
page.add(gd)
if __name__ == "__main__":
ft.run(main)To reproduce
- Run the repro code
- Long press the ListTile
- Right-click the ListTile
- See the console output
Expected behavior
When I right-click, the console should output TapEvent(...).
Screenshots / Videos
Operating System
Windows
Operating system details
Windows 11 25H2 (26200.6899)
Flet version
0.70.0.dev6555
Regression
I'm not sure / I don't know
Suggestions
No response
Logs
Logs
python3 gesturedetector_test.py
LongPressStartEvent(name='long_press_start', data=None, local_position=Offset(x=40.0, y=38.0), global_position=Offset(x=50.0, y=48.0))
Event(name='secondary_tap', data=None)Additional details
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
