-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.py
More file actions
52 lines (41 loc) · 1.45 KB
/
Copy pathmain.py
File metadata and controls
52 lines (41 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# --------------------------------------------------------
# Licensed under the terms of the BSD 3-Clause License
# (see LICENSE for details).
# Copyright © 2026, Alexander Suvorov
# All rights reserved.
# --------------------------------------------------------
# https://github.com/smartlegionlab/
# --------------------------------------------------------
import flet as ft
from core.controllers import TodoApp
from core.theme_manager import ThemeManager
def main(page: ft.Page):
page.title = "Smart Todo App. Copyright © 2026, Alexander Suvorov; All rights reserved."
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
page.scroll = ft.ScrollMode.ADAPTIVE
theme_manager = ThemeManager()
page.theme_mode = (
ft.ThemeMode.DARK if theme_manager.theme == "dark" else ft.ThemeMode.LIGHT
)
def toggle_theme(e):
theme_manager.toggle()
page.theme_mode = (
ft.ThemeMode.DARK if theme_manager.theme == "dark" else ft.ThemeMode.LIGHT
)
page.update()
page.appbar = ft.AppBar(
title=ft.Text("Smart Todo App"),
center_title=True,
bgcolor=ft.colors.SURFACE_VARIANT,
actions=[
ft.IconButton(
icon=ft.icons.BRIGHTNESS_6_OUTLINED,
tooltip="Toggle Dark/Light Mode",
on_click=toggle_theme,
),
],
)
todo_app = TodoApp()
page.add(todo_app)
todo_app.load_tasks()
ft.app(main)