flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.5k stars 449 forks source link

CupertinoSlidingSegmentedButton crashing (freezing) on selection. #4176

Closed Dejv311 closed 2 weeks ago

Dejv311 commented 1 month ago

Duplicate Check

Describe the bug

Clicking on any button of the CupertinoSlidingSegmentedButton will freeze the entire flet window on linux. Launching the same app with --web works as expected. The app is still running, just extremely slow (see picture) - multiple seconds per frame.

image

Code sample

Code ```python [Paste your code here] ```

To reproduce

import flet as ft

def main(page: ft.Page):
    page.theme_mode = ft.ThemeMode.LIGHT

    page.overlay.append(ft.AlertDialog(content=ft.Row(controls=[
        ft.Column(controls=[
            ft.Text("Title", theme_style=ft.TextThemeStyle.TITLE_LARGE),
        ], expand=1),
        ft.VerticalDivider(),
        ft.Column(controls=[
            ft.Text("El test", theme_style=ft.TextThemeStyle.TITLE_LARGE),
            ft.CupertinoSlidingSegmentedButton(
                thumb_color=ft.colors.BLUE_400,
                on_change=lambda e: print(f"selected_index: {e.data}"),
                # padding=ft.padding.symmetric(0, 10),
                controls=[
                    ft.Text("One"),
                    ft.Text("Two"),
                    ft.Text("Three")
                ],
            ),
        ], expand=1)
    ]), open=True))
    page.update()

ft.app(main)

Expected behavior

No response

Screenshots / Videos

Captures [Upload media here]

Operating System

Linux

Operating system details

PopOS 22.04 (Ubuntu based)

Flet version

0.24.1

Regression

I'm not sure / I don't know

Suggestions

No response

Logs

Logs ```console [Paste your logs here] ```

Additional details

package:media_kit_libs_linux registered. selected_index: 0 selected_index: 1 selected_index: 2 selected_index: 1 selected_index: 0 ...

OwenMcDonnell commented 1 month ago

I'm unable to reproduce this via wsl2 (Ubuntu 22.04) on Windows. Are you running PopOS on a local or cloud VM?