flet icon indicating copy to clipboard operation
flet copied to clipboard

Container "long press action" triggered both ```on_click``` and ```on_long_press``` events

Open lekshmanmj opened this issue 1 year ago • 0 comments

Description Container long press triggered both on_click and on_long_press events when I test this events in flet android test app. command: flet run --android

Code example to reproduce the issue:

import flet as ft

def main(page: ft.Page):
    page.padding = 0
    def on_long_press(e):
        print('on long press')
        page.add(ft.Text('on_long_press triggered'))
    def on_click(e):
        print('on click')
        page.add(ft.Text('on_click triggered'))
    container = ft.Container(
        bgcolor= ft.colors.RED,
        content= ft.Text('Test Long Press'),
        height= 100,
        width= 100,
        on_click= on_click,
        on_long_press= on_long_press 
    )
    page.add(ft.SafeArea(container))
    
ft.app(target=main)

Describe the results you received: Screenshot_2024-02-22-04-20-44-856_com appveyor flet

Describe the results you expected: Expected it to trigger only long_press event on "long press" action even when both on_click and on_long_press event methods are set.

Flet version (pip show flet):

Name: flet
Version: 0.20.2
Summary: Flet for Python - easily build interactive multi-platform apps in Python
Home-page: 
Author: Appveyor Systems Inc.
Author-email: [email protected]
License: Apache-2.0
Location: /home/lekshman/bbb/bbb_env/lib/python3.11/site-packages
Requires: cookiecutter, flet-runtime, packaging, qrcode, watchdog, websocket-client, websockets
Required-by: 

Give your requirements.txt file (don't pip freeze, instead give direct packages):

flet

Operating system: Kali Linux - debian based OS

Additional environment details: Test environment is Flet android testing app.

lekshmanmj avatar Feb 21 '24 22:02 lekshmanmj