flet icon indicating copy to clipboard operation
flet copied to clipboard

Unable to Retrieve 'data' Property from PopupMenuItem in Version 0.21.1

Open 7576457 opened this issue 1 year ago • 3 comments

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)

7576457 avatar Mar 07 '24 15:03 7576457

Sorry, what was the issue?

FeodorFitsner avatar Mar 07 '24 16:03 FeodorFitsner

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.

7576457 avatar Mar 07 '24 18:03 7576457

Sorry, what was the issue?

It seems I rushed again. Please, check the code I provided for versions 0.20 and 0.21.1.

7576457 avatar Mar 09 '24 10:03 7576457

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

ndonkoHenri avatar Apr 01 '24 22:04 ndonkoHenri