30 lines
953 B
Python
30 lines
953 B
Python
import flet as ft
|
|
|
|
from app.widgets.adaptive_menu import adaptive_menu
|
|
|
|
def main_layout(page: ft.Page, content_container: ft.Container):
|
|
print(">>> ENTER main_layout")
|
|
menu = adaptive_menu(page)
|
|
|
|
# ตรวจสอบโหมด (ป้องกันหน้าจอขาวจาก width=0)
|
|
width = page.width if page.width > 0 else 1024 # default ไว้ที่ desktop ก่อนถ้ายังไม่รู้ width
|
|
is_mobile = width < 600
|
|
print(f">>> Device mode: {'MOBILE' if is_mobile else 'DESKTOP'} (Width: {page.width})")
|
|
|
|
if is_mobile:
|
|
return ft.Column(
|
|
controls=[
|
|
content_container,
|
|
menu
|
|
],
|
|
expand=True
|
|
)
|
|
else:
|
|
return ft.Row(
|
|
controls=[
|
|
menu,
|
|
ft.VerticalDivider(width=1),
|
|
content_container
|
|
],
|
|
expand=True
|
|
) |