-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
109 lines (98 loc) · 2.89 KB
/
Copy pathmain.py
File metadata and controls
109 lines (98 loc) · 2.89 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import flet as ft
from views.home import home_page
from views.setting import setting_page
def main(page: ft.Page):
page.title = "Applifi"
page.window_width = 770
page.window_height = 495
page.window_resizable = False
page.padding = 0
page.fonts = {
"nunito_dun": "fonts/Nunito-Bold.ttf",
"nunito": "fonts/Nunito-VariableFont_wght.ttf",
}
page.theme = ft.Theme(font_family="nunito_dun")
logo = ft.Container(
content=ft.Image(src="img/logo.png", height=45, width=45),
alignment=ft.alignment.center,
height=47,
margin=10,
)
a = ft.IconButton(
icon=ft.icons.HOME,
style=ft.ButtonStyle(
color="#5B0098",
bgcolor="#0C0C0C",
shape=ft.RoundedRectangleBorder(radius=5),
),
on_click=lambda _: page.go("/"),
)
b = ft.IconButton(
icon=ft.icons.SETTINGS,
style=ft.ButtonStyle(
color="#5B0098",
bgcolor="#0C0C0C",
shape=ft.RoundedRectangleBorder(radius=5),
),
on_click=lambda _: page.go("/setting"),
)
iconos = ft.Column(
controls=[a, b],
alignment=ft.MainAxisAlignment.END, # Mueve los botones al fondo
spacing=20
)
nab = ft.Container(
content=ft.Column(
controls=[logo, iconos],
alignment=ft.MainAxisAlignment.START,
horizontal_alignment=ft.CrossAxisAlignment.CENTER,
),
height=478,
width=70,
bgcolor="#131313",
alignment=ft.alignment.center,
)
def route_change(route):
page.views.clear()
if page.route == "/":
page.views.append(
ft.View(
"/",
[
ft.Row(
spacing=0,
controls=[
nab,
home_page,
],
alignment=ft.MainAxisAlignment.CENTER,
),
],
padding=0,
)
)
elif page.route == "/setting":
page.views.append(
ft.View(
"/setting",
[
ft.Row(
spacing=0,
controls=[
nab,
setting_page,
],
),
],
padding=0,
)
)
page.update()
def view_pop(view):
page.views.pop()
top_view = page.views[-1]
page.go(top_view.route)
page.on_route_change = route_change
page.on_view_pop = view_pop
page.go(page.route)
ft.app(target=main, assets_dir="assets")