Chip control icon change problem #2619
Unanswered
burhansvural
asked this question in
Q&A
Replies: 1 comment 1 reply
-
In contrast to Flutter/Dart, Flet is not reactive. import flet as ft
def main(page: ft.Page):
favorite: bool = False
def test_chip_click(e):
nonlocal favorite
print(favorite)
favorite = not favorite
e.control.leading.name = ft.icons.FAVORITE if not favorite else ft.icons.FAVORITE_OUTLINE_SHARP
print(favorite)
page.update()
test_chip_control = ft.Chip(
label=ft.Text("Test Label Text"),
leading=ft.Icon(
ft.icons.FAVORITE if not favorite else ft.icons.FAVORITE_OUTLINE_SHARP
),
autofocus=True,
on_click=test_chip_click,
)
page.add(ft.Row(controls=[test_chip_control]))
ft.app(target=main) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Question
Why doesn't the chip control icon change? It is necessary to write new codes in control.py
Code sample
Error message
------------------------------------------------------
Beta Was this translation helpful? Give feedback.
All reactions