Home UI test
This commit is contained in:
parent
fe476afa54
commit
8869f77118
@ -1,4 +1,4 @@
|
||||
# <img src="https://git.cubable.date/BillPay/app/~raw/dev/assets/icon.png" alt="icon" width="50" height="50"/> BillPay (WIP)
|
||||
# <img src="https://git.cubable.date/BillPay/app/~raw/dev/assets/icon.png" alt="icon" width="45" height="45"/> BillPay (WIP)
|
||||
|
||||
A fully Independent Application for cross platform
|
||||
|
||||
|
6
main.py
6
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)
|
||||
|
149
modules/home.py
149
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,
|
||||
],
|
||||
)
|
||||
|
@ -4,7 +4,7 @@ import os
|
||||
static = """
|
||||
|
||||
[general]
|
||||
name = CustomIcon
|
||||
name =
|
||||
phone =
|
||||
email =
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user