Skip to content
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

Container "long press action" triggered both on_click and on_long_press events #2712

Closed
lekshmanmj opened this issue Feb 21, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@lekshmanmj
Copy link
Contributor

lekshmanmj commented Feb 21, 2024

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: hello@flet.dev
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 lekshmanmj changed the title Container **long press** action triggered both on_click and on_long_press events Container "long press action" triggered both on_click and on_long_press events Feb 21, 2024
@FeodorFitsner FeodorFitsner added the bug Something isn't working label Feb 22, 2024
@FeodorFitsner FeodorFitsner self-assigned this Mar 8, 2024
@ndonkoHenri
Copy link
Contributor

Should have been fixed by #2914

@jmv74211
Copy link

jmv74211 commented May 18, 2024

Hello @ndonkoHenri

I think it has been fixed in the desktop app version, but I'm trying it on Android and I think it still doesn't work.

When trying to do the on_long_press on a container, it always triggers the on_click event first.

I have the version updated to 0.22.1.

Could you please check it?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants