FletX
FletX is a powerful dynamic routing and global state management library for the Flet framework. It simplifies application development by separating UI and logic while providing intuitive navigation solutions.
✨ Features
- Seamless Routing: Effortless and dynamic navigation management.
- State Management: Manage complex states with ease.
- Logic-UI Separation: Keep your code clean and maintainable.
- Lightweight and Fast: Designed for performance.
📦 Installation
Add the FletX package to your project:
pip install fletx
🚀 Getting Started
🌟 Statefull Counter App Example
Directory & File Structure
📦CounterApp
├── main.py
├── states
│ └── main_state.py
└── views
├── counter_view.py
└── home_view.py
main.py
import flet as ft
from fletx import Xapp,route
from states.main_state import MainState
from views.home_view import HomeView
from views.counter_view import CounterView
def main(page: ft.Page):
page.title = "FletX counter example"
Xapp(
page=page,
init_route="/",
state=MainState,
routes=[
route(route="/",view=HomeView),
route(route="/counter",view=CounterView),
]
)
ft.app(main)
states/main_state.py
import flet as ft
from fletx import Xstate
class MainState(Xstate):
def __init__(self, page):
super().__init__(page)
self.txt_number = ft.TextField(value="0", text_align=ft.TextAlign.RIGHT, width=100)
def minus_click(self,e):
self.txt_number.value = str(int(self.txt_number.value) - 1)
self.update()
def plus_click(self,e):
self.txt_number.value = str(int(self.txt_number.value) + 1)
self.update()
views/home_view.py
import flet as ft
from fletx import Xview
class HomeView(Xview):
def build(self):
return ft.View(
horizontal_alignment=ft.CrossAxisAlignment.CENTER,
vertical_alignment=ft.MainAxisAlignment.CENTER,
controls=[
ft.Text("Home View"),
ft.Text(f"Counts = {self.state.txt_number.value}"),
ft.ElevatedButton("Go Counter View",on_click=lambda e:self.go("/counter"))
]
)
views/counter_view.py
import flet as ft
from fletx import Xview
class CounterView(Xview):
def build(self):
return ft.View(
horizontal_alignment=ft.CrossAxisAlignment.CENTER,
vertical_alignment=ft.MainAxisAlignment.CENTER,
controls=[
ft.Row(
[
ft.IconButton(ft.Icons.REMOVE, on_click=self.state.minus_click),
self.state.txt_number,
ft.IconButton(ft.Icons.ADD, on_click=self.state.plus_click),
],
alignment=ft.MainAxisAlignment.CENTER,
),
ft.ElevatedButton("<< Back",on_click=self.back)
]
)
❤️ Feedback
Found this repository helpful? Let us know!
- ⭐ Star the FletX repository
- Report issues or suggest improvements in the Issues section
Metadata
Release files for fletx 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fletx-0.2.0.tar.gz | 8.5 kB | Without provenance | Details for fletx-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fletx-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for fletx-0.2.0-py3-none-any.whl |
Total release size: 18.6 kB
Release files / fletx-0.2.0.tar.gz
| Download URL | fletx-0.2.0.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
984c2f24c829f021fead2f7fb13727e6b53dec8c5f3e4571d6f7d691db3bca5b
|
|
BLAKE2b-256 checksum How to use checksums |
818d1a317beb47d76b2289675991051005a6145aa981fa08469990250bfd1b03
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.1
|
Release files / fletx-0.2.0-py3-none-any.whl
| Download URL | fletx-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b495e0dcae779b673683213cbf71be0b5848d8c69889a3053a205547fc2d33a1
|
|
BLAKE2b-256 checksum How to use checksums |
08f68427581c738f3efe0be296a177e404c182a773b1ba58a454ba0a68c1a151
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.13.1
|
Security for fletx 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.