Skip to content

TextButton.visible = True not working in AlertDialog #5487

@Creeper19472

Description

@Creeper19472

Flet 0.28.3

pyproject.toml

dependencies = [
  "flet==0.28.3",
  "flet_permission_handler",
  "flet-open-file @ git+https://github.com/creeper19472/flet-open-file",
  "flet_model",
  "websockets",
  "pycryptodome",
  "cffi",
  "requests"
]

The code that is in question is as follows:

_cancel_button = ft.TextButton()

def _cancel_upload(e: ft.ControlEvent):
       _cancel_button.disabled = True
       page.update()

_ok_button = ft.TextButton(
        "确定",
        visible=False,
        on_click=lambda _: page.close(upload_dialog),
)

_cancel_button.on_click = _cancel_upload
_cancel_button.text = "取消"

upload_dialog = ft.AlertDialog(
            modal=True,
            title=ft.Text("批量上传"),
            content=ft.Column(
                controls=[progress_column],
                width=400,
                alignment=ft.MainAxisAlignment.CENTER,
                scroll=ft.ScrollMode.AUTO,
                expand=True,
            ),
            actions=[
                _ok_button,
                _cancel_button,
            ],
        )
page.open(upload_dialog)

But when executing the code below, _ok_button doesn't display as expected:

_ok_button.visible = True
page.update()

I think TextButton should update normally, but it's not at the moment.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions