Skip to content

Commit

Permalink
Fix Page.open() breaking after multiple calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ndonkoHenri committed Jun 21, 2024
1 parent c2b8fe1 commit c85c715
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions sdk/python/packages/flet-core/src/flet_core/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -1415,26 +1415,24 @@ def __on_invoke_method_result(self, e) -> None:
def open(self, control: Control) -> None:
if not hasattr(control, "open"):
raise ValueError("control has no open attribute")

control.open = True

if isinstance(control, NavigationDrawer):
if control.position == NavigationDrawerPosition.END:
if self.end_drawer != control:
self.end_drawer = control
self.update()
else:
if self.drawer != control:
self.drawer = control
self.update()
else:
control.open = True
if isinstance(control, NavigationDrawer):
if control.position == NavigationDrawerPosition.END:
if self.end_drawer == control:
control.update()
return
else:
self.end_drawer = control
else:
if self.drawer == control:
control.update()
return
else:
self.drawer = control
self.update() # called only if the new drawer is different from the current one
elif control not in self.__offstage.controls:
if control not in self.__offstage.controls:
self.__offstage.controls.append(control)
self.__offstage.update()
return

control.update()

@staticmethod
def close(control: Control) -> None:
Expand Down

0 comments on commit c85c715

Please sign in to comment.