import flet as ft
def main(page: ft.Page):
page.title = 'BrotherLin Loader'
page.theme_mode = 'dark'
def change_theme(e):
if page.theme_mode == ft.ThemeMode.LIGHT:
page.theme_mode = ft.ThemeMode.DARK
e.control.selected = not e.control.selected
else:
page.theme_mode = ft.ThemeMode.LIGHT
e.control.selected = not e.control.selected
page.update()
theme_button = ft.IconButton(
icon=ft.icons.SUNNY,
selected_icon=ft.icons.NIGHTLIGHT,
on_click=change_theme,
selected=False
)
# Создаем Column с выравниванием SPACE_BETWEEN
content = ft.Column(
[
ft.Container(height=50), # Пустой контейнер для создания пространства сверху
ft.Container(
content=theme_button,
alignment=ft.alignment.center
)
],
alignment=ft.MainAxisAlignment.SPACE_BETWEEN,
expand=True
)
page.add(content)
ft.app(target=main, assets_dir='assets')