From 8869f77118d3aff2d88b8792c30af5c553982506 Mon Sep 17 00:00:00 2001 From: CustomIcon Date: Sat, 20 Apr 2024 03:43:58 +0000 Subject: [PATCH] Home UI test --- README.md | 2 +- main.py | 6 +- modules/home.py | 149 +++++++++++++++++++++++---- modules/settings/functions/config.py | 2 +- utils/title.py | 2 +- 5 files changed, 135 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index d5ef853..fa79c63 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# icon BillPay (WIP) +# icon BillPay (WIP) A fully Independent Application for cross platform diff --git a/main.py b/main.py index 28d7a8e..8fff741 100644 --- a/main.py +++ b/main.py @@ -4,10 +4,10 @@ from utils import views_handler def main(page: ft.Page): page.title = 'BillPay' - # print("Initial route:", page.route) + print("Initial route:", page.route) def route_change(e): - # print("Route change:", e.route) + print("Route change:", e.route) page.views.clear() page.views.append( views_handler(page)[page.route], @@ -15,7 +15,7 @@ def main(page: ft.Page): page.update() def view_pop(e): - # print("View pop:", e.view) + print("View pop:", e.view) page.views.pop() top_view = page.views[-1] page.go(top_view.route) diff --git a/modules/home.py b/modules/home.py index 5efd69b..e377be1 100644 --- a/modules/home.py +++ b/modules/home.py @@ -1,34 +1,143 @@ import flet as ft from utils import AppView, Title from modules.settings import config +from datetime import datetime + + +def greet(time: datetime): + if 5 <= time.hour < 12: + return "Goodmorning," + elif 12 <= time.hour < 18: + return "Goodafternoon," + else: + return "Goodevening," def Home(page: ft.Page): + contentColumn = ft.Container( + padding=10, + content=ft.Column( + controls=[ + ft.Text( + greet(datetime.now()), + size=50, + weight=ft.FontWeight.W_200, + ), + ft.Text( + config.get('general', 'name').split(" ")[0], + size=40, + weight=ft.FontWeight.W_200, + ), + ft.Divider(), + ft.ResponsiveRow( + [ + ft.Container( + content=ft.Text("A"), + margin=10, + padding=10, + bgcolor=ft.colors.with_opacity(0.1, '#000000'), + border_radius=10, + ), + ft.Divider(), + ft.Container( + content=ft.Text("B"), + margin=10, + padding=10, + bgcolor=ft.colors.with_opacity(0.1, '#000000'), + border_radius=10, + ), + ft.Divider(), + ft.Container( + content=ft.Text("C"), + margin=10, + padding=10, + bgcolor=ft.colors.with_opacity(0.1, '#000000'), + border_radius=10, + ), + ft.Divider(), + ft.Container( + content=ft.Text("D"), + margin=10, + padding=10, + bgcolor=ft.colors.with_opacity(0.1, '#000000'), + border_radius=10, + ), + ], + alignment=ft.MainAxisAlignment.CENTER, + ), + ft.Divider(), + ft.Container( + margin=10, + padding=10, + bgcolor=ft.colors.with_opacity(0.1, '#000000'), + border_radius=10, + content=ft.Row( + [ + ft.Container( + content=ft.Icon(ft.icons.APPS), + margin=10, + padding=10, + alignment=ft.alignment.center, + bgcolor=ft.colors.GREY_700, + width=60, + height=60, + border_radius=10, + on_click=None, + ), + ft.Container( + content=ft.Icon(ft.icons.HISTORY), + margin=10, + padding=10, + alignment=ft.alignment.center, + bgcolor=ft.colors.GREY_700, + width=60, + height=60, + border_radius=10, + on_click=None, + ), + ft.Container( + content=ft.Icon(ft.icons.SETTINGS), + margin=10, + padding=10, + alignment=ft.alignment.center, + bgcolor=ft.colors.GREY_700, + width=60, + height=60, + border_radius=10, + ink=True, + on_click=lambda _: page.go("/settings"), + ), + ft.Container( + content=ft.Icon(ft.icons.LIST), + margin=10, + padding=10, + alignment=ft.alignment.center, + bgcolor=ft.colors.GREY_700, + width=60, + height=60, + border_radius=10, + ink=True, + on_click=lambda e: print("Clickable with Ink clicked!"), + ), + ], + alignment=ft.MainAxisAlignment.CENTER, + ), + ), + ], + ), + ) return AppView( '/', [ ft.AppBar( title=ft.Text(Title(__file__)), - actions=[ - ft.IconButton( - icon=ft.icons.SETTINGS, - on_click=lambda _: page.go('/settings'), - ), - ], - ), - ft.Container( - height=100, - padding=10, - content=ft.Column( - controls=[ - ft.Text( - 'Goodmorning,', - ), - ft.Text( - config.get('general', 'name'), - ), - ], - ), + # actions=[ + # ft.IconButton( + # icon=ft.icons.SETTINGS, + # on_click=lambda _: page.go('/settings'), + # ), + # ], ), + contentColumn, ], ) diff --git a/modules/settings/functions/config.py b/modules/settings/functions/config.py index 9647aa2..7fc57e4 100644 --- a/modules/settings/functions/config.py +++ b/modules/settings/functions/config.py @@ -4,7 +4,7 @@ import os static = """ [general] -name = CustomIcon +name = phone = email = diff --git a/utils/title.py b/utils/title.py index d7900b6..2d916c6 100644 --- a/utils/title.py +++ b/utils/title.py @@ -2,4 +2,4 @@ import os def Title(title: str): - return str(os.path.basename(title)).replace('.py', '').title() + return str(os.path.basename(title)).split(".")[0].title()