settings UI
This commit is contained in:
parent
f5694011b8
commit
1720af54e9
@ -20,7 +20,7 @@ jobs:
|
||||
.\venv\Scripts\activate.ps1
|
||||
pip install -r requirements.txt
|
||||
git config --global --add safe.directory '*'
|
||||
flet build apk --include-packages flet_lottie --product WAMCO --product WAMCO --org com.wamco.app --verbose
|
||||
flet build apk --include-packages flet_lottie --product BillPay --product BillPay --org com.billpay --verbose
|
||||
useTTY: false
|
||||
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
|
||||
- !PublishArtifactStep
|
||||
|
@ -1,4 +1,4 @@
|
||||
from .settings import Settings
|
||||
from .config import config
|
||||
from .functions import config
|
||||
|
||||
__all__ = ["Settings", "config"]
|
3
modules/settings/functions/__init__.py
Normal file
3
modules/settings/functions/__init__.py
Normal file
@ -0,0 +1,3 @@
|
||||
from .config import config
|
||||
from .theme import Theme
|
||||
__all__ = ['config', 'Theme']
|
@ -2,8 +2,9 @@ from configparser import ConfigParser
|
||||
import os
|
||||
|
||||
static = """
|
||||
|
||||
[general]
|
||||
name =
|
||||
name = CustomIcon
|
||||
phone =
|
||||
email =
|
||||
|
||||
@ -30,12 +31,18 @@ property =
|
||||
nid =
|
||||
|
||||
[mwsc]
|
||||
|
||||
meter_no =
|
||||
account_no =
|
||||
mobile_no =
|
||||
|
||||
[stelco]
|
||||
|
||||
account_no =
|
||||
bill_no =
|
||||
|
||||
[medianet]
|
||||
account_no =
|
||||
nid =
|
||||
phone =
|
||||
"""
|
||||
|
||||
class Config(ConfigParser):
|
16
modules/settings/functions/theme.py
Normal file
16
modules/settings/functions/theme.py
Normal file
@ -0,0 +1,16 @@
|
||||
import flet as ft
|
||||
|
||||
class Theme:
|
||||
def __init__(self, page: ft.Page) -> None:
|
||||
self.page = page
|
||||
|
||||
def change(self, theme: ft.ThemeMode = None):
|
||||
if theme:
|
||||
self.page.theme_mode = theme
|
||||
else:
|
||||
self.page.theme_mode = (
|
||||
ft.ThemeMode.DARK
|
||||
if self.page.theme_mode == ft.ThemeMode.LIGHT
|
||||
else ft.ThemeMode.LIGHT
|
||||
)
|
||||
self.page.update()
|
@ -1,8 +1,265 @@
|
||||
import flet as ft
|
||||
from utils import AppView, Title
|
||||
|
||||
from .functions import Theme
|
||||
|
||||
def Settings(page: ft.Page):
|
||||
settingsContainer = ft.ListView(
|
||||
expand=True
|
||||
)
|
||||
settingsContainer.controls.append(ft.Text("General"))
|
||||
generalSettings = ft.Container(
|
||||
content=ft.Column(
|
||||
controls=[
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
ink=True,
|
||||
content=ft.Column(
|
||||
[
|
||||
ft.ListTile(
|
||||
leading=ft.Icon(ft.icons.PERSON),
|
||||
title=ft.Text("Username"),
|
||||
subtitle=ft.Text(
|
||||
"The greeting message"
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
padding=10,
|
||||
on_click=lambda _: print("clicked username"),
|
||||
)
|
||||
),
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
ink=True,
|
||||
content=ft.Column(
|
||||
[
|
||||
ft.ListTile(
|
||||
leading=ft.Icon(ft.icons.PHONE),
|
||||
title=ft.Text("Phone"),
|
||||
subtitle=ft.Text(
|
||||
"Personal Phone number"
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
padding=10,
|
||||
on_click=lambda _: print("clicked phone"),
|
||||
)
|
||||
),
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
ink=True,
|
||||
content=ft.Column(
|
||||
[
|
||||
ft.ListTile(
|
||||
leading=ft.Icon(ft.icons.EMAIL),
|
||||
title=ft.Text("Email"),
|
||||
subtitle=ft.Text(
|
||||
"Personal Email"
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
padding=10,
|
||||
on_click=lambda _: print("clicked email"),
|
||||
)
|
||||
),
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
ink=True,
|
||||
content=ft.Column(
|
||||
[
|
||||
ft.ListTile(
|
||||
leading=ft.Icon(ft.icons.CARD_TRAVEL),
|
||||
title=ft.Text("NID"),
|
||||
subtitle=ft.Text(
|
||||
"National Idenity Number"
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
padding=10,
|
||||
on_click=lambda _: print("clicked email"),
|
||||
)
|
||||
),
|
||||
]
|
||||
)
|
||||
)
|
||||
settingsContainer.controls.append(
|
||||
generalSettings
|
||||
)
|
||||
settingsContainer.controls.append(ft.Divider())
|
||||
settingsContainer.controls.append(ft.Text("Notifications"))
|
||||
notificationsSettings = ft.Container(
|
||||
content=ft.Column(
|
||||
controls=[
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
ink=True,
|
||||
content=ft.Column(
|
||||
[
|
||||
ft.ListTile(
|
||||
leading=ft.Icon(ft.icons.TELEGRAM),
|
||||
title=ft.Text("Telegram"),
|
||||
subtitle=ft.Text(
|
||||
"Telegram Notifications for reminders and Bill pays"
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
padding=10,
|
||||
on_click=lambda _: print("clicked username"),
|
||||
)
|
||||
),
|
||||
]
|
||||
)
|
||||
)
|
||||
settingsContainer.controls.append(
|
||||
notificationsSettings
|
||||
)
|
||||
settingsContainer.controls.append(ft.Divider())
|
||||
settingsContainer.controls.append(ft.Text("Apps"))
|
||||
appsSettings = ft.Container(
|
||||
content=ft.Column(
|
||||
controls=[
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
ink=True,
|
||||
content=ft.Column(
|
||||
[
|
||||
ft.ListTile(
|
||||
leading=ft.Image(
|
||||
border_radius=ft.border_radius.all(10),
|
||||
fit=ft.ImageFit.CONTAIN,
|
||||
src="https://asset.brandfetch.io/idZJsIaold/id9-VJM_HU.png"
|
||||
),
|
||||
title=ft.Text("Dhiraagu"),
|
||||
subtitle=ft.Text(
|
||||
"An ISP Service."
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
padding=10,
|
||||
on_click=lambda _: print("clicked dhiraagu"),
|
||||
)
|
||||
),
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
ink=True,
|
||||
content=ft.Column(
|
||||
[
|
||||
ft.ListTile(
|
||||
leading=ft.Image(
|
||||
border_radius=ft.border_radius.all(10),
|
||||
fit=ft.ImageFit.CONTAIN,
|
||||
src="https://asset.brandfetch.io/idR1xFKHLD/idu6J-WQsm.jpeg"
|
||||
),
|
||||
title=ft.Text("Ooredoo"),
|
||||
subtitle=ft.Text(
|
||||
"An ISP Service."
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
padding=10,
|
||||
on_click=lambda _: print("clicked ooredoo"),
|
||||
)
|
||||
),
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
ink=True,
|
||||
content=ft.Column(
|
||||
[
|
||||
ft.ListTile(
|
||||
leading=ft.Image(
|
||||
border_radius=ft.border_radius.all(10),
|
||||
fit=ft.ImageFit.CONTAIN,
|
||||
src="https://www.stelco.com.mv/wp-content/uploads/2022/02/unnamed.png"
|
||||
),
|
||||
title=ft.Text("STELCO"),
|
||||
subtitle=ft.Text(
|
||||
"Electricity Bills"
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
padding=10,
|
||||
on_click=lambda _: print("clicked stelco"),
|
||||
)
|
||||
),
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
ink=True,
|
||||
content=ft.Column(
|
||||
[
|
||||
ft.ListTile(
|
||||
leading=ft.Image(
|
||||
border_radius=ft.border_radius.all(10),
|
||||
fit=ft.ImageFit.CONTAIN,
|
||||
src="https://asset.brandfetch.io/idOZWUOUm-/idNastd9Bg.jpeg"
|
||||
),
|
||||
title=ft.Text("MWSC"),
|
||||
subtitle=ft.Text(
|
||||
"Water Bills"
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
padding=10,
|
||||
on_click=lambda _: print("clicked mwsc"),
|
||||
)
|
||||
),
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
ink=True,
|
||||
content=ft.Column(
|
||||
[
|
||||
ft.ListTile(
|
||||
leading=ft.Image(
|
||||
border_radius=ft.border_radius.all(10),
|
||||
fit=ft.ImageFit.CONTAIN,
|
||||
src="https://asset.brandfetch.io/idLMZnv5SC/iduyX4keYN.jpeg"
|
||||
),
|
||||
title=ft.Text("Medianet"),
|
||||
subtitle=ft.Text(
|
||||
"Online Television Service"
|
||||
),
|
||||
),
|
||||
]
|
||||
),
|
||||
padding=10,
|
||||
on_click=lambda _: print("clicked medianet"),
|
||||
)
|
||||
),
|
||||
]
|
||||
)
|
||||
)
|
||||
settingsContainer.controls.append(appsSettings)
|
||||
settingsContainer.controls.append(ft.Divider())
|
||||
settingsContainer.controls.append(ft.Text("Theme"))
|
||||
def _on_theme_change(e):
|
||||
Theme(page).change()
|
||||
themeSettings = ft.Container(
|
||||
content=ft.Column(
|
||||
controls=[
|
||||
ft.Card(
|
||||
content=ft.Container(
|
||||
content=ft.Container(
|
||||
ft.Switch(
|
||||
value=True,
|
||||
label=" Switch to dark theme",
|
||||
on_change=_on_theme_change
|
||||
),
|
||||
),
|
||||
padding=10,
|
||||
on_click=None,
|
||||
)
|
||||
),
|
||||
]
|
||||
)
|
||||
)
|
||||
settingsContainer.controls.append(themeSettings)
|
||||
return AppView(
|
||||
"/settings",
|
||||
[
|
||||
@ -14,6 +271,6 @@ def Settings(page: ft.Page):
|
||||
title=ft.Text(Title(str(__file__))),
|
||||
bgcolor=ft.colors.TRANSPARENT
|
||||
),
|
||||
ft.Text("Settings!"),
|
||||
settingsContainer
|
||||
],
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user