import flet as ft
from home import Home

def main(page: ft.Page):
    page.title = 'AquilaSoft'
    page.theme = ft.Theme(color_scheme_seed=ft.Colors.BLUE)
    
    page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
    page.vertical_alignment = ft.MainAxisAlignment.CENTER
    page.theme_mode = ft.ThemeMode.LIGHT
    page.padding = 0

    def route_change(route):
        page.controls.clear()
        
        if "/" == route:
            home = Home(page)
            page.add(home.build())

    page.update()

    page.on_route_change = lambda _: route_change(page.route)
    page.go('/')

ft.app(target=main, assets_dir="assets", view=ft.WEB_BROWSER, port=8550)