You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Friends,
In order to allow conditional controls in literal lists, Flet could ignore any None value, so we can write:
condition= ...
ft.Row([
ft.IconButton(...),
ft.IconButton(...),
ft.IconButton(...),
ft.IconButton(...),
ft.Text('Conditional Component') ifconditionelseNone, # <<---- This is not supported right nowft.IconButton(...),
]),
The previous code prevents the Component to be included depending on condition. But if I want the control to be included but initially invisible, there is also a solution:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi Friends,
In order to allow conditional controls in literal lists, Flet could ignore any None value, so we can write:
I have implemented my own solution:
So we can do:
The previous code prevents the Component to be included depending on condition. But if I want the control to be included but initially invisible, there is also a solution:
This kind if small utilities can help in code readability and expressing intention.
Beta Was this translation helpful? Give feedback.
All reactions