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 on_click callback breaks containers without explicit size #140

Closed
mikaelho opened this issue Aug 3, 2022 · 0 comments · Fixed by #144
Closed

Container on_click callback breaks containers without explicit size #140

mikaelho opened this issue Aug 3, 2022 · 0 comments · Fixed by #144
Labels
bug Something isn't working
Milestone

Comments

@mikaelho
Copy link
Contributor

mikaelho commented Aug 3, 2022

Using flet 0.1.43.

With this code, I get a full screen red box, as expected:

import flet
from flet import Container, Page, colors

def main(page: Page):
    page.add(Container(expand=True, bgcolor=colors.RED))
    page.update()

flet.app(target=main)

If I add an on_click handler, the container breaks in mysterious ways:

  • Light grey background
  • Runs over the bottom of the screen
  • Mouse pointer shows that the container is clickable, but the callback does not work (even with Fix Container on_click callback #139 in place).
import flet
from flet import Container, Page, colors

def was_clicked(event):
    print("Clicked")

def main(page: Page):
    page.add(Container(expand=True, bgcolor=colors.RED, on_click=was_clicked))
    page.update()

flet.app(target=main)

If I give the container a fixed size, all is good and the callback works.

import flet
from flet import Container, Page, colors

def was_clicked(event):
    print("Clicked")

def main(page: Page):
    page.add(Container(width=100, height=100, bgcolor=colors.RED, on_click=was_clicked))
    page.update()

flet.app(target=main)
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

Successfully merging a pull request may close this issue.

2 participants