flet icon indicating copy to clipboard operation
flet copied to clipboard

Inconsistent Control behavior on Android: work in dev, malfunction when packaged

Open tanmay-bhatgare opened this issue 5 months ago • 5 comments

Duplicate Check

  • [x] I have searched the opened issues and there are no duplicates

Describe the bug

After packaging app into .apk some of the app widgets misbehave mostly ones containing dialogues or pop ups. These all window work great in development mode but don't know why they just don't open in real android device, tried every way and didn't work any of them, this behavior is also shown by widgets containing images stored locally. eg. container etc. See this, #3866

Code sample

Code
import flet as ft


def main(page: ft.Page):
    page.title = "AlertDialog examples"
    page.horizontal_alignment = ft.CrossAxisAlignment.CENTER

    dlg = ft.AlertDialog(
        title=ft.Text("Hi, this is a non-modal dialog!"),
        on_dismiss=lambda e: page.add(ft.Text("Non-modal dialog dismissed")),
    )

    def handle_close(e):
        page.close(dlg_modal)
        page.add(ft.Text(f"Modal dialog closed with action: {e.control.text}"))

    dlg_modal = ft.AlertDialog(
        modal=True,
        title=ft.Text("Please confirm"),
        content=ft.Text("Do you really want to delete all those files?"),
        actions=[
            ft.TextButton("Yes", on_click=handle_close),
            ft.TextButton("No", on_click=handle_close),
        ],
        actions_alignment=ft.MainAxisAlignment.END,
        on_dismiss=lambda e: page.add(
            ft.Text("Modal dialog dismissed"),
        ),
    )

    page.add(
        ft.ElevatedButton("Open dialog", on_click=lambda e: page.open(dlg)),
        ft.ElevatedButton("Open modal dialog", on_click=lambda e: page.open(dlg_modal)),
    )


ft.app(target=main)

To reproduce

  1. Build a apk using flet build apk.
  2. Open the app and press the button nothing will work neither crash.

Expected behavior

In real android device all the widget should behave as expected but widgets containing dialogues or pop up don't even respond or open and don't throw any error or info.

Screenshots / Videos

Captures

[Upload media here]

Operating System

Windows

Operating system details

windows 11

Flet version

0.23.2

Regression

No, it isn't

Suggestions

No response

Logs

Logs
[Paste your logs here]

Additional details

No response

tanmay-bhatgare avatar Aug 25 '24 05:08 tanmay-bhatgare