flet icon indicating copy to clipboard operation
flet copied to clipboard

Switch thumb icons are not shown in --web view.

Open Katsiuk opened this issue 1 year ago • 8 comments

Duplicate Check

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

Describe the bug

Hi, @ndonkoHenri @FeodorFitsner ! Can you please help me understand what happened? Icons for the Swich toggle are not shown in the --web view. Checked on Linux and Windows. Worked on 0.24.1.

Code sample

import flet as ft

def main(page: ft.Page):
    def theme_changed(e):
        page.theme_mode = (
            ft.ThemeMode.DARK
            if page.theme_mode == ft.ThemeMode.LIGHT
            else ft.ThemeMode.LIGHT
        )
        c.label = (
            "Light theme" if page.theme_mode == ft.ThemeMode.LIGHT else "Dark theme"
        )
        c.thumb_icon = (
            ft.Icons.NIGHTLIGHT if page.theme_mode == ft.ThemeMode.DARK else ft.Icons.SUNNY
        )
        page.update()

    page.theme_mode = ft.ThemeMode.LIGHT
    c = ft.Switch(label="Light theme", on_change=theme_changed)
    c.thumb_icon = (
        ft.Icons.NIGHTLIGHT if page.theme_mode == ft.ThemeMode.DARK else ft.Icons.SUNNY
    )
    page.add(c)

ft.app(main)

To reproduce

Run the following command: flet run --web main.py

Image

Image

Expected behavior

I expect to see the result, just like during a regular run. flet run main.py

Image

Image

Screenshots / Videos

Operating System

Windows

Operating system details

Windows 10, Ubuntu 22.04.5 LTS

Flet version

0.27.4

Regression

Yes, it used to work in a previous Flet version (please specify the version in additional details)

Suggestions

No response

Logs

Logs dont contain errors.

Additional details

Worked on 0.24.1.

Katsiuk avatar Mar 03 '25 22:03 Katsiuk

I investigated and found out that this started with v0.25.2.

Katsiuk avatar Mar 05 '25 08:03 Katsiuk

I tried changing a lot of things, but nothing helped. I don't understand what could be causing this. This only applies to the Switches.

Katsiuk avatar Mar 05 '25 23:03 Katsiuk

It works on my end, with the latest Flet version:

Image

Please create a new venv, install Flet and retry: pip install 'flet[all]'

ndonkoHenri avatar Mar 06 '25 00:03 ndonkoHenri

This really helped. It seems like something happened during the update. But I tried to downgrade to the pro version and it started working, but when I updated to the latest version, it stopped working again.

Katsiuk avatar Mar 06 '25 06:03 Katsiuk

Thank you and sorry for bothering you.

Katsiuk avatar Mar 06 '25 06:03 Katsiuk

Sorry again. Well, checked my application and faced the same problem. Tried a new venv but got the same behavior: WEB

Image

APP

Image

If I downgrade to version 0.25.1, everything works. This problematic situation starts with version 0.25.2.

I have the following modules installed: aiofiles==24.1.0 aiohappyeyeballs==2.5.0 aiohttp==3.11.13 aiosignal==1.3.2 aiosqlite==0.21.0 annotated-types==0.7.0 anyio==4.8.0 arrow==1.3.0 attrs==25.1.0 bcrypt==4.3.0 binaryornot==0.4.4 certifi==2025.1.31 cffi==1.17.1 chardet==5.2.0 charset-normalizer==3.4.1 click==8.1.8 colorama==0.4.6 cookiecutter==2.6.0 cryptography==44.0.2 fastapi==0.115.11 flet==0.27.5 flet-cli==0.27.5 flet-desktop==0.27.5 flet-web==0.27.5 frozenlist==1.5.0 h11==0.14.0 httpcore==1.0.7 httptools==0.6.4 httpx==0.28.1 idna==3.10 itsdangerous==2.2.0 Jinja2==3.1.6 markdown-it-py==3.0.0 MarkupSafe==3.0.2 mdurl==0.1.2 multidict==6.1.0 oauthlib==3.2.2 packaging==24.2 propcache==0.3.0 pycparser==2.22 pydantic==2.10.6 pydantic_core==2.27.2 Pygments==2.19.1 pypng==0.20220715.0 python-dateutil==2.9.0.post0 python-dotenv==1.0.1 python-slugify==8.0.4 PyYAML==6.0.2 qrcode==7.4.2 repath==0.9.0 requests==2.32.3 rich==13.9.4 six==1.17.0 sniffio==1.3.1 starlette==0.46.0 text-unidecode==1.3 toml==0.10.2 types-python-dateutil==2.9.0.20241206 typing_extensions==4.12.2 urllib3==2.3.0 uvicorn==0.34.0 watchdog==4.0.2 watchfiles==1.0.4 websockets==15.0.1 Werkzeug==3.1.3 yarl==1.18.3

Katsiuk avatar Mar 06 '25 06:03 Katsiuk

Tried different browsers (Chrome, Opera, Edge). Other independent switch toggles are also affected: APP

Image

WEB

Image

But everytihing is fine with version 0.25.1.

Katsiuk avatar Mar 06 '25 07:03 Katsiuk

It seems I found a solution. I forgot to update the flutter*.js files in my assets directory. This caused this problem.

Thank you and sorry again.

Katsiuk avatar Mar 06 '25 13:03 Katsiuk