Repository navigation
How to achieve conditional rendering of user control children #766
|
Hi, I have a user control with some conditions in class MyControl(ft.UserControl):
def __init__(self):
self.dynamic_member = 0
def some_callback(self):
self.dynamic_member += 1
self.update()
def build(self):
if self.dynamic_member == 0:
return ft.Text("oops, it's 0")
return ft.Text(f"it's {self.dynamic_member}")I expect that by calling There is not much documentation on this area and I suppose I don't have a good understanding on how flet works, so I'm stuck here. Any help (with some explanations if possible) would be much appreciated. |
Replies: 1 comment
|
Hi, you have to work by reference to do this simply. |
Hi, you have to work by reference to do this simply.