flet
flet copied to clipboard
Unable to Retrieve 'data' Property from PopupMenuItem in Version 0.21.1
Issue: When I updated flet to version 0.21.1, I encountered the issue that it became impossible to retrieve the 'data' property when clicking on PopupMenuItem. Prior to this, in version 0.20.0, I could retrieve this property from PopupMenuItem.
Demonstrations: flet_version_0.20.0.webm flet_version_0.21.1.webm
Code:
import flet as ft
def main(page: ft.Page):
def lola(e):
print('Current flet Version 0.21.1: ', e.control.data)
options = ft.PopupMenuButton(
icon=ft.icons.MORE_HORIZ_OUTLINED,
visible=True,
items=[
ft.PopupMenuItem(text="change", data='tata'),
ft.PopupMenuItem(text="delete", data='tata', on_click=lola),
]
)
page.add(options)
ft.app(target=main)
Sorry, what was the issue?
I apologize for not providing a response earlier. I'm not entirely sure what the issue was, but I made some changes to the project architecture and reinstalled the latest version of Flet. I've come to the conclusion that the problem wasn't with Flet itself, but rather with how I wrote the code.
Despite checking the code with different versions and isolating the provided code from my project, the problem was still resolved by reinstalling: pip install -U flet.
Sorry, what was the issue?
It seems I rushed again. Please, check the code I provided for versions 0.20 and 0.21.1.
A pre-release with the fix concerning this issue is now available. Try it and report if you face any further issues or have any questions:
pip install flet --pre