diff --git a/.gitignore b/.gitignore index af754d5..3a924b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.db __pycache__ -*.temp \ No newline at end of file +*.temp +*.json \ No newline at end of file diff --git a/src/main.py b/src/main.py index 0b99740..90bbde9 100644 --- a/src/main.py +++ b/src/main.py @@ -1,9 +1,10 @@ import flet as ft +import json from pages.home import * def main(page: ft.Page): page.title = "Fuji" - page.theme = ft.Theme(color_scheme_seed=ft.Colors.RED) + page.theme = ft.Theme(color_scheme_seed=ft.Colors.RED, font_family="Roboto") def changePage(index): pages = [ @@ -105,4 +106,44 @@ def main(page: ft.Page): ) ) -ft.app(main) +def login(page: ft.Page): + page.title = "Log in" + page.theme = ft.Theme(color_scheme_seed=ft.Colors.RED, font_family="Roboto") + + loginpage = ft.Container( + content=ft.Column( + [ + ft.Image( + src="https://i.imgur.com/t49tb4d.png", + width=200, + height=200, + fit=ft.ImageFit.NONE, + repeat=ft.ImageRepeat.NO_REPEAT, + border_radius=ft.border_radius.all(100)), + + ft.Text(value="Welcome to Fuji!", size=48) + ], + alignment=ft.MainAxisAlignment.CENTER, # Center text vertically in Column + horizontal_alignment=ft.CrossAxisAlignment.CENTER, # Center text horizontally + ), + alignment=ft.alignment.center, # Center the entire container on the page + expand=True, # Allow the container to take full page size + ) + + page.add(loginpage) + page.update() + + +if __name__ == "__main__": + try: + with open("config.json", "r") as file: + data = json.load(file) + if data.get("isLoggedIn", False): + ft.app(target=main) + else: + ft.app(target=login) + except FileNotFoundError: + config = {"isLoggedIn": False} + with open("config.json", "w") as file: + json.dump(config, file) + ft.app(target=login) \ No newline at end of file diff --git a/src/pages/home.py b/src/pages/home.py index c2ae7c6..6e2cb68 100644 --- a/src/pages/home.py +++ b/src/pages/home.py @@ -1,12 +1,5 @@ import flet as ft - -grade1 = "#F44336" -grade2 = "#FF9800" -grade3 = "#eebd00" -grade4 = "#4CAF50" -grade5 = "#2196F3" -grade6 = "#9C27B0" -gradeother = "#5D5D5D" +from vars import * def HomePage(): return ft.Column([ @@ -32,7 +25,7 @@ def HomePage(): margin=20, padding=10, alignment=ft.alignment.top_left, - bgcolor='#271D1C', + bgcolor=ft.Colors.SURFACE_CONTAINER_HIGHEST, width=420, height=270, border_radius=10, @@ -53,7 +46,7 @@ def HomePage(): margin=0, padding=0, alignment=ft.alignment.center, - bgcolor=grade6, + bgcolor=grade[6], width=20, height=20, border_radius=5, @@ -63,7 +56,7 @@ def HomePage(): margin=0, padding=0, alignment=ft.alignment.center, - bgcolor=grade5, + bgcolor=grade[5], width=20, height=20, border_radius=5, @@ -73,7 +66,7 @@ def HomePage(): margin=0, padding=0, alignment=ft.alignment.center, - bgcolor=grade4, + bgcolor=grade[4], width=20, height=20, border_radius=5, @@ -83,7 +76,7 @@ def HomePage(): margin=0, padding=0, alignment=ft.alignment.center, - bgcolor=grade3, + bgcolor=grade[3], width=20, height=20, border_radius=5, @@ -93,7 +86,7 @@ def HomePage(): margin=0, padding=0, alignment=ft.alignment.center, - bgcolor=grade2, + bgcolor=grade[2], width=20, height=20, border_radius=5, @@ -103,7 +96,7 @@ def HomePage(): margin=0, padding=0, alignment=ft.alignment.center, - bgcolor=grade1, + bgcolor=grade[1], width=20, height=20, border_radius=5, @@ -119,7 +112,7 @@ def HomePage(): margin=20, padding=10, alignment=ft.alignment.top_left, - bgcolor='#271D1C', + bgcolor=ft.Colors.SURFACE_CONTAINER_HIGHEST, width=420, height=270, border_radius=10,