1
0
Fork 0
forked from Fuji/Fuji

Added initial login screen, added json configuration file and slightly updated card colors and made use of the vars file in the home page

This commit is contained in:
Maarceeli 2025-02-09 19:27:38 +01:00
parent 79bd692c88
commit 75ea385205
No known key found for this signature in database
GPG key ID: 9AAC4EB2A4F969EB
3 changed files with 54 additions and 19 deletions

3
.gitignore vendored
View file

@ -1,3 +1,4 @@
*.db *.db
__pycache__ __pycache__
*.temp *.temp
*.json

View file

@ -1,9 +1,10 @@
import flet as ft import flet as ft
import json
from pages.home import * from pages.home import *
def main(page: ft.Page): def main(page: ft.Page):
page.title = "Fuji" 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): def changePage(index):
pages = [ 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)

View file

@ -1,12 +1,5 @@
import flet as ft import flet as ft
from vars import *
grade1 = "#F44336"
grade2 = "#FF9800"
grade3 = "#eebd00"
grade4 = "#4CAF50"
grade5 = "#2196F3"
grade6 = "#9C27B0"
gradeother = "#5D5D5D"
def HomePage(): def HomePage():
return ft.Column([ return ft.Column([
@ -32,7 +25,7 @@ def HomePage():
margin=20, margin=20,
padding=10, padding=10,
alignment=ft.alignment.top_left, alignment=ft.alignment.top_left,
bgcolor='#271D1C', bgcolor=ft.Colors.SURFACE_CONTAINER_HIGHEST,
width=420, width=420,
height=270, height=270,
border_radius=10, border_radius=10,
@ -53,7 +46,7 @@ def HomePage():
margin=0, margin=0,
padding=0, padding=0,
alignment=ft.alignment.center, alignment=ft.alignment.center,
bgcolor=grade6, bgcolor=grade[6],
width=20, width=20,
height=20, height=20,
border_radius=5, border_radius=5,
@ -63,7 +56,7 @@ def HomePage():
margin=0, margin=0,
padding=0, padding=0,
alignment=ft.alignment.center, alignment=ft.alignment.center,
bgcolor=grade5, bgcolor=grade[5],
width=20, width=20,
height=20, height=20,
border_radius=5, border_radius=5,
@ -73,7 +66,7 @@ def HomePage():
margin=0, margin=0,
padding=0, padding=0,
alignment=ft.alignment.center, alignment=ft.alignment.center,
bgcolor=grade4, bgcolor=grade[4],
width=20, width=20,
height=20, height=20,
border_radius=5, border_radius=5,
@ -83,7 +76,7 @@ def HomePage():
margin=0, margin=0,
padding=0, padding=0,
alignment=ft.alignment.center, alignment=ft.alignment.center,
bgcolor=grade3, bgcolor=grade[3],
width=20, width=20,
height=20, height=20,
border_radius=5, border_radius=5,
@ -93,7 +86,7 @@ def HomePage():
margin=0, margin=0,
padding=0, padding=0,
alignment=ft.alignment.center, alignment=ft.alignment.center,
bgcolor=grade2, bgcolor=grade[2],
width=20, width=20,
height=20, height=20,
border_radius=5, border_radius=5,
@ -103,7 +96,7 @@ def HomePage():
margin=0, margin=0,
padding=0, padding=0,
alignment=ft.alignment.center, alignment=ft.alignment.center,
bgcolor=grade1, bgcolor=grade[1],
width=20, width=20,
height=20, height=20,
border_radius=5, border_radius=5,
@ -119,7 +112,7 @@ def HomePage():
margin=20, margin=20,
padding=10, padding=10,
alignment=ft.alignment.top_left, alignment=ft.alignment.top_left,
bgcolor='#271D1C', bgcolor=ft.Colors.SURFACE_CONTAINER_HIGHEST,
width=420, width=420,
height=270, height=270,
border_radius=10, border_radius=10,