flet icon indicating copy to clipboard operation
flet copied to clipboard

Web event type names differ from app event type names

Open brycepg opened this issue 7 months ago • 0 comments

Duplicate Check

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

Describe the bug

As a web app event names are minified or something: $ python picharttest.py HOVER: nified:a_W HOVER: nified:a_X HOVER: nified:a_T HOVER: nified:a_Y HOVER: nified:Jh HOVER: nified:a_X HOVER: nified:a_X

As a regular app event names are correct: $ python picharttest.py HOVER: PointerHoverEvent HOVER: PanDownEvent HOVER: TapDownEvent HOVER: TapUpEvent HOVER: PointerHoverEvent

Code

import flet as ft

def main(page: ft.Page):
    normal_border = ft.BorderSide(0, ft.colors.with_opacity(0, ft.colors.WHITE))
    hovered_border = ft.BorderSide(6, ft.colors.WHITE)

    def on_chart_event(e: ft.PieChartEvent):
        for idx, section in enumerate(chart.sections):
            section.border_side = (
                hovered_border if idx == e.section_index else normal_border
            )
            if idx == e.section_index:
                print("HOVER: ", e.type)
        chart.update()

    chart = ft.PieChart(
        sections=[
            ft.PieChartSection(
                25,
                color=ft.colors.BLUE,
                radius=80,
                border_side=normal_border,
            ),
            ft.PieChartSection(
                25,
                color=ft.colors.YELLOW,
                radius=65,
                border_side=normal_border,
            ),
            ft.PieChartSection(
                25,
                color=ft.colors.PINK,
                radius=60,
                border_side=normal_border,
            ),
            ft.PieChartSection(
                25,
                color=ft.colors.GREEN,
                radius=70,
                border_side=normal_border,
            ),
        ],
        sections_space=1,
        center_space_radius=0,
        on_chart_event=on_chart_event,
        expand=True,
    )

    page.add(chart)

# ft.app(main)
ft.app(target=main, view=ft.AppView.WEB_BROWSER)

To reproduce

  1. Run code
  2. Click on pi chart cell
  3. Observe that the event type names have been minified? they don't match between web and regular app

Expected behavior

Event type names should be preserved to preserve cross platform compatibility:

For example my code is looking for TapUpEvent which is renamed in the web app to nified:a_Y.

Screenshots

No response

Operating System

Linux

Operating system details

Fedora

Flet version

latest and 19.0

Regression

No, it isn't

Suggestions

No response

Additional details

No response

brycepg avatar Jun 26 '24 02:06 brycepg