first try navigation rail fix
This commit is contained in:
@@ -36,11 +36,31 @@ class DashboardPage:
|
|||||||
height=60,
|
height=60,
|
||||||
fit=ft.ImageFit.CONTAIN
|
fit=ft.ImageFit.CONTAIN
|
||||||
)
|
)
|
||||||
|
self.logo_container = ft.Container(
|
||||||
|
content=ft.Column(
|
||||||
|
controls=[self.logo],
|
||||||
|
alignment=ft.MainAxisAlignment.CENTER,
|
||||||
|
horizontal_alignment=ft.CrossAxisAlignment.CENTER,
|
||||||
|
spacing=5,
|
||||||
|
),
|
||||||
|
padding=10,
|
||||||
|
)
|
||||||
|
self.user = self.get_user()
|
||||||
|
|
||||||
|
def _on_resize(self, e):
|
||||||
|
# Hide logo in the navigation rail if window height is too small
|
||||||
|
try:
|
||||||
|
height = e.height or 0
|
||||||
|
except Exception:
|
||||||
|
height = 0
|
||||||
|
if hasattr(self, "logo_container"):
|
||||||
|
self.logo_container.visible = height > 600 # threshold in pixels; adjust if needed
|
||||||
|
self.logo_container.update()
|
||||||
self.subscription_status = ft.Text(
|
self.subscription_status = ft.Text(
|
||||||
"",
|
"",
|
||||||
color=ft.Colors.RED
|
color=ft.Colors.RED
|
||||||
)
|
)
|
||||||
self.user = self.get_user()
|
|
||||||
|
|
||||||
# --- helper to parse created_at values coming from API in multiple formats ---
|
# --- helper to parse created_at values coming from API in multiple formats ---
|
||||||
def _parse_dt(self, s):
|
def _parse_dt(self, s):
|
||||||
@@ -404,6 +424,10 @@ class DashboardPage:
|
|||||||
print("Error loading subscription:", e)
|
print("Error loading subscription:", e)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
|
# Responsive behavior: hide logo in nav rail when window is short
|
||||||
|
self.page.on_resize = self._on_resize
|
||||||
|
current_height = self.page.height or 0
|
||||||
|
self.logo_container.visible = current_height > 600
|
||||||
self.status = {
|
self.status = {
|
||||||
'active':'Active',
|
'active':'Active',
|
||||||
'cancelled':'Cancelled',
|
'cancelled':'Cancelled',
|
||||||
@@ -460,15 +484,7 @@ class DashboardPage:
|
|||||||
icon=ft.Icons.LOGOUT, label="Logout"
|
icon=ft.Icons.LOGOUT, label="Logout"
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
leading=ft.Container(
|
leading=self.logo_container,
|
||||||
content=ft.Column(
|
|
||||||
controls=[self.logo],
|
|
||||||
alignment=ft.MainAxisAlignment.CENTER,
|
|
||||||
horizontal_alignment=ft.CrossAxisAlignment.CENTER,
|
|
||||||
spacing=5,
|
|
||||||
),
|
|
||||||
padding=10
|
|
||||||
),
|
|
||||||
#bgcolor = ft.Colors.BLUE,
|
#bgcolor = ft.Colors.BLUE,
|
||||||
|
|
||||||
trailing = ft.Column(
|
trailing = ft.Column(
|
||||||
|
|||||||
Reference in New Issue
Block a user