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

page.dialog is not working #92

Open
Pranzal360 opened this issue Sep 10, 2023 · 6 comments
Open

page.dialog is not working #92

Pranzal360 opened this issue Sep 10, 2023 · 6 comments

Comments

@Pranzal360
Copy link

Pranzal360 commented Sep 10, 2023

I was working with this file and i tried to run it in my system, when ever the website load, the dialog box doesn't appears.
but it works after the second execution.

Let me make it simple for you to understand
let me start with:
i run the code and it opens in the browser but the dialog box doesn't appears, now i don't close the tab where it is opened and now i stop the code and run it again, this time too it opens in another tab, this time too dialog box doesn't appears on the second tab but it opens in the previously opened tab.

image
image

the tab on first image was opened during second execution where page.dialog doesn't opens
the tab on the second image was opened during first execution where initially page.dialog didn't open but after second execution (without closing the tab ) page.dialog opened.

@Pranzal360 Pranzal360 changed the title Tutorial > Chat_3 > page.dialog isn't working page.dialog is not responding correctly Sep 10, 2023
@Pranzal360 Pranzal360 changed the title page.dialog is not responding correctly page.dialog is not working Sep 10, 2023
@barantt
Copy link

barantt commented Nov 30, 2023

Yes, I also encountered this problem
in the chat demo
but it does work with this demo code alertdialog

@ndonkoHenri
Copy link
Collaborator

Hey @barantt, @Pranzal360, could you please attach some code to reproduce the issue?

@Pranzal360
Copy link
Author

i used the code from flet examples
and the dialog box doesn't opens, i forgot how i got that error in the original issue but this code also doesn't works,
image

if further info is required please feel free to mention, sorry for late response !

@macill0
Copy link

macill0 commented Jun 23, 2024

Hey, I'm a little late on this, but has anyone figured out what the problem was?
I'm currently encountering the same issue!

@macill0
Copy link

macill0 commented Jun 23, 2024

UPDATE: I found my issue. I'm no longer sure if I had the same one...

My problem (from my understanding) was that I initialized my page wrong. I added an AlertDialog to the page without adding something else. Then I switched with the router to another page.view component. And tried to show another dialog with page.show_diaog(dialog)

wrong code:

def main(page: ft.Page) -> None:
    """
    Entry point of application
    """ 
     
    page.title = "Notes App"
    page.adaptive = True
    
    if not page.client_storage.contains_key(StorageKeys.BASE_PATH.value): 
        alert_set_path: ft.AlertDialog = AlertDialogSetBasePath(page=page).build()
        page.add(alert_set_path)
        page.show_dialog(alert_set_path)
    
    while True:

SOLUTION:

  1. Initialize your page better ;)
  2. Quick and dirty: use page.clean() or page.controls.clean after you no longer need the dialog

@ndonkoHenri
Copy link
Collaborator

The tutorials have been updated, please give another try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants