<div style="text-align: center;">
<img src="docs/assets/fletx.png"/>
</div>
# FletX
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Platform](https://img.shields.io/badge/Platform-Flet-blue)](#)
[![Version](https://img.shields.io/badge/Version-0.1.6-brightgreen)](#)
[![Downloads](https://static.pepy.tech/badge/fletx)](https://pepy.tech/project/fletx)
FletX is a powerful **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:
```bash
pip install fletx
```
## π Getting Started
### π Statefull Counter App Example
**Directory & File Structure**
```bash
π¦CounterApp
βββ main.py
βββ states
βΒ Β βββ main_state.py
βββ views
βββ counter_view.py
βββ home_view.py
```
**main.py**
````python
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**
```python
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**
```python
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**
```python
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)
]
)
```
<img src="docs/assets/counter.gif"/>
## β€οΈ Feedback
Found this repository helpful? Let us know!
- β Star the [FletX repository](https://github.com/saurabhwadekar/FletX)
- Report issues or suggest improvements in the [Issues section](https://github.com/saurabhwadekar/FletX/issues)
Raw data
{
"_id": null,
"home_page": "https://github.com/saurabhwadekar/FletX",
"name": "fletx",
"maintainer": "Saurabh Wadekar",
"docs_url": null,
"requires_python": null,
"maintainer_email": "saurabhwadekar420@gmail.com",
"keywords": "flet, routing, fletx, routes, state, flet app",
"author": "Saurabh Wadekar [ INDIA ]",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/02/5e/2f551a5af9693cb78f5da83c524be400774e5a01b4d377072b85d249530b/fletx-0.1.7.tar.gz",
"platform": null,
"description": "<div style=\"text-align: center;\">\n<img src=\"docs/assets/fletx.png\"/>\n</div>\n\n# FletX \n\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) \n[![Platform](https://img.shields.io/badge/Platform-Flet-blue)](#) \n[![Version](https://img.shields.io/badge/Version-0.1.6-brightgreen)](#) \n[![Downloads](https://static.pepy.tech/badge/fletx)](https://pepy.tech/project/fletx)\n\nFletX is a powerful **routing** and **global state management** library for the Flet framework. It simplifies application development by separating UI and logic while providing intuitive navigation solutions.\n\n---\n\n## \u2728 Features \n\n- **Seamless Routing**: Effortless and dynamic navigation management. \n- **State Management**: Manage complex states with ease. \n- **Logic-UI Separation**: Keep your code clean and maintainable. \n- **Lightweight and Fast**: Designed for performance. \n\n---\n\n## \ud83d\udce6 Installation \n\nAdd the FletX package to your project: \n\n```bash\npip install fletx\n```\n\n## \ud83d\ude80 Getting Started\n### \ud83c\udf1f Statefull Counter App Example\n**Directory & File Structure**\n```bash\n\ud83d\udce6CounterApp\n \u251c\u2500\u2500 main.py\n \u251c\u2500\u2500 states\n \u2502\u00a0\u00a0 \u2514\u2500\u2500 main_state.py\n \u2514\u2500\u2500 views\n \u251c\u2500\u2500 counter_view.py\n \u2514\u2500\u2500 home_view.py\n```\n\n**main.py**\n````python\nimport flet as ft\nfrom fletx import Xapp,route\nfrom states.main_state import MainState\nfrom views.home_view import HomeView\nfrom views.counter_view import CounterView\n\ndef main(page: ft.Page):\n page.title = \"FletX counter example\"\n\n Xapp(\n page=page,\n init_route=\"/\",\n state=MainState,\n routes=[\n route(route=\"/\",view=HomeView),\n route(route=\"/counter\",view=CounterView),\n ]\n )\n\nft.app(main)\n````\n**states/main_state.py**\n```python\nimport flet as ft\nfrom fletx import Xstate\n\nclass MainState(Xstate):\n def __init__(self, page):\n super().__init__(page)\n \n self.txt_number = ft.TextField(value=\"0\", text_align=ft.TextAlign.RIGHT, width=100)\n\n def minus_click(self,e):\n self.txt_number.value = str(int(self.txt_number.value) - 1)\n self.update()\n\n def plus_click(self,e):\n self.txt_number.value = str(int(self.txt_number.value) + 1)\n self.update()\n```\n**views/home_view.py**\n```python\nimport flet as ft \nfrom fletx import Xview\n\nclass HomeView(Xview):\n\n def build(self):\n return ft.View(\n horizontal_alignment=ft.CrossAxisAlignment.CENTER,\n vertical_alignment=ft.MainAxisAlignment.CENTER,\n controls=[\n ft.Text(\"Home View\"),\n ft.Text(f\"Counts = {self.state.txt_number.value}\"),\n ft.ElevatedButton(\"Go Counter View\",on_click=lambda e:self.go(\"/counter\"))\n ]\n )\n```\n**views/counter_view.py**\n```python\nimport flet as ft \nfrom fletx import Xview\n\nclass CounterView(Xview):\n\n def build(self):\n return ft.View(\n horizontal_alignment=ft.CrossAxisAlignment.CENTER,\n vertical_alignment=ft.MainAxisAlignment.CENTER,\n controls=[\n ft.Row(\n [\n ft.IconButton(ft.Icons.REMOVE, on_click=self.state.minus_click),\n self.state.txt_number,\n ft.IconButton(ft.Icons.ADD, on_click=self.state.plus_click),\n ],\n alignment=ft.MainAxisAlignment.CENTER,\n ),\n ft.ElevatedButton(\"<< Back\",on_click=self.back)\n ]\n )\n```\n\n<img src=\"docs/assets/counter.gif\"/>\n\n## \u2764\ufe0f Feedback\nFound this repository helpful? Let us know!\n\n- \u2b50 Star the [FletX repository](https://github.com/saurabhwadekar/FletX)\n- Report issues or suggest improvements in the [Issues section](https://github.com/saurabhwadekar/FletX/issues)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "FletX is a powerful routing and state management library for the Flet framework. It simplifies application development by separating UI and logic while providing intuitive navigation solutions.",
"version": "0.1.7",
"project_urls": {
"Homepage": "https://github.com/saurabhwadekar/FletX"
},
"split_keywords": [
"flet",
" routing",
" fletx",
" routes",
" state",
" flet app"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "cf7dd2fd7965a9f0ef9d0938cdbfe1c93c583b4862ff7633f1b9cf291b922149",
"md5": "54e05f8fda487a99f05e8ade27d5f5fd",
"sha256": "936fc076e19268929215028999b6e7b9eba8c6fc2f70d334d030a0e1f33d1193"
},
"downloads": -1,
"filename": "fletx-0.1.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "54e05f8fda487a99f05e8ade27d5f5fd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8216,
"upload_time": "2024-12-20T08:58:06",
"upload_time_iso_8601": "2024-12-20T08:58:06.613097Z",
"url": "https://files.pythonhosted.org/packages/cf/7d/d2fd7965a9f0ef9d0938cdbfe1c93c583b4862ff7633f1b9cf291b922149/fletx-0.1.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "025e2f551a5af9693cb78f5da83c524be400774e5a01b4d377072b85d249530b",
"md5": "775a90b30dc413e54b079b2878fbe7a9",
"sha256": "3d302f07de31a754707ed6118c4e0879e9f663160e299ab594d62e5bf53b6962"
},
"downloads": -1,
"filename": "fletx-0.1.7.tar.gz",
"has_sig": false,
"md5_digest": "775a90b30dc413e54b079b2878fbe7a9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7425,
"upload_time": "2024-12-20T08:58:10",
"upload_time_iso_8601": "2024-12-20T08:58:10.011164Z",
"url": "https://files.pythonhosted.org/packages/02/5e/2f551a5af9693cb78f5da83c524be400774e5a01b4d377072b85d249530b/fletx-0.1.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-20 08:58:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "saurabhwadekar",
"github_project": "FletX",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "annotated-types",
"specs": [
[
"==",
"0.7.0"
]
]
},
{
"name": "anyio",
"specs": [
[
"==",
"4.6.2.post1"
]
]
},
{
"name": "arrow",
"specs": [
[
"==",
"1.3.0"
]
]
},
{
"name": "babel",
"specs": [
[
"==",
"2.16.0"
]
]
},
{
"name": "binaryornot",
"specs": [
[
"==",
"0.4.4"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2024.8.30"
]
]
},
{
"name": "cffi",
"specs": [
[
"==",
"1.17.1"
]
]
},
{
"name": "chardet",
"specs": [
[
"==",
"5.2.0"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"3.4.0"
]
]
},
{
"name": "click",
"specs": [
[
"==",
"8.1.7"
]
]
},
{
"name": "colorama",
"specs": [
[
"==",
"0.4.6"
]
]
},
{
"name": "cookiecutter",
"specs": [
[
"==",
"2.6.0"
]
]
},
{
"name": "cryptography",
"specs": [
[
"==",
"44.0.0"
]
]
},
{
"name": "docutils",
"specs": [
[
"==",
"0.21.2"
]
]
},
{
"name": "fastapi",
"specs": [
[
"==",
"0.115.5"
]
]
},
{
"name": "flet",
"specs": [
[
"==",
"0.25.1"
]
]
},
{
"name": "flet-cli",
"specs": [
[
"==",
"0.25.1"
]
]
},
{
"name": "flet-desktop",
"specs": [
[
"==",
"0.25.1"
]
]
},
{
"name": "flet-desktop-light",
"specs": [
[
"==",
"0.25.1"
]
]
},
{
"name": "flet-web",
"specs": [
[
"==",
"0.25.1"
]
]
},
{
"name": "ghp-import",
"specs": [
[
"==",
"2.1.0"
]
]
},
{
"name": "h11",
"specs": [
[
"==",
"0.14.0"
]
]
},
{
"name": "httpcore",
"specs": [
[
"==",
"1.0.7"
]
]
},
{
"name": "httptools",
"specs": [
[
"==",
"0.6.4"
]
]
},
{
"name": "httpx",
"specs": [
[
"==",
"0.28.0"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"3.10"
]
]
},
{
"name": "jaraco.classes",
"specs": [
[
"==",
"3.4.0"
]
]
},
{
"name": "jaraco.context",
"specs": [
[
"==",
"6.0.1"
]
]
},
{
"name": "jaraco.functools",
"specs": [
[
"==",
"4.1.0"
]
]
},
{
"name": "jeepney",
"specs": [
[
"==",
"0.8.0"
]
]
},
{
"name": "Jinja2",
"specs": [
[
"==",
"3.1.4"
]
]
},
{
"name": "keyring",
"specs": [
[
"==",
"25.5.0"
]
]
},
{
"name": "Markdown",
"specs": [
[
"==",
"3.7"
]
]
},
{
"name": "markdown-it-py",
"specs": [
[
"==",
"3.0.0"
]
]
},
{
"name": "MarkupSafe",
"specs": [
[
"==",
"3.0.2"
]
]
},
{
"name": "mdurl",
"specs": [
[
"==",
"0.1.2"
]
]
},
{
"name": "mergedeep",
"specs": [
[
"==",
"1.3.4"
]
]
},
{
"name": "mkdocs",
"specs": [
[
"==",
"1.6.1"
]
]
},
{
"name": "mkdocs-get-deps",
"specs": [
[
"==",
"0.2.0"
]
]
},
{
"name": "mkdocs-material",
"specs": [
[
"==",
"9.5.49"
]
]
},
{
"name": "mkdocs-material-extensions",
"specs": [
[
"==",
"1.3.1"
]
]
},
{
"name": "more-itertools",
"specs": [
[
"==",
"10.5.0"
]
]
},
{
"name": "nh3",
"specs": [
[
"==",
"0.2.19"
]
]
},
{
"name": "oauthlib",
"specs": [
[
"==",
"3.2.2"
]
]
},
{
"name": "packaging",
"specs": [
[
"==",
"24.2"
]
]
},
{
"name": "paginate",
"specs": [
[
"==",
"0.5.7"
]
]
},
{
"name": "pathspec",
"specs": [
[
"==",
"0.12.1"
]
]
},
{
"name": "pkginfo",
"specs": [
[
"==",
"1.11.2"
]
]
},
{
"name": "platformdirs",
"specs": [
[
"==",
"4.3.6"
]
]
},
{
"name": "pycparser",
"specs": [
[
"==",
"2.22"
]
]
},
{
"name": "pydantic",
"specs": [
[
"==",
"2.10.2"
]
]
},
{
"name": "pydantic_core",
"specs": [
[
"==",
"2.27.1"
]
]
},
{
"name": "Pygments",
"specs": [
[
"==",
"2.18.0"
]
]
},
{
"name": "pymdown-extensions",
"specs": [
[
"==",
"10.12"
]
]
},
{
"name": "pypng",
"specs": [
[
"==",
"0.20220715.0"
]
]
},
{
"name": "python-dateutil",
"specs": [
[
"==",
"2.9.0.post0"
]
]
},
{
"name": "python-dotenv",
"specs": [
[
"==",
"1.0.1"
]
]
},
{
"name": "python-slugify",
"specs": [
[
"==",
"8.0.4"
]
]
},
{
"name": "PyYAML",
"specs": [
[
"==",
"6.0.2"
]
]
},
{
"name": "pyyaml_env_tag",
"specs": [
[
"==",
"0.1"
]
]
},
{
"name": "qrcode",
"specs": [
[
"==",
"7.4.2"
]
]
},
{
"name": "readme_renderer",
"specs": [
[
"==",
"44.0"
]
]
},
{
"name": "regex",
"specs": [
[
"==",
"2024.11.6"
]
]
},
{
"name": "repath",
"specs": [
[
"==",
"0.9.0"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.32.3"
]
]
},
{
"name": "requests-toolbelt",
"specs": [
[
"==",
"1.0.0"
]
]
},
{
"name": "rfc3986",
"specs": [
[
"==",
"2.0.0"
]
]
},
{
"name": "rich",
"specs": [
[
"==",
"13.9.4"
]
]
},
{
"name": "SecretStorage",
"specs": [
[
"==",
"3.3.3"
]
]
},
{
"name": "setuptools",
"specs": [
[
"==",
"75.6.0"
]
]
},
{
"name": "six",
"specs": [
[
"==",
"1.16.0"
]
]
},
{
"name": "sniffio",
"specs": [
[
"==",
"1.3.1"
]
]
},
{
"name": "starlette",
"specs": [
[
"==",
"0.41.3"
]
]
},
{
"name": "text-unidecode",
"specs": [
[
"==",
"1.3"
]
]
},
{
"name": "toml",
"specs": [
[
"==",
"0.10.2"
]
]
},
{
"name": "twine",
"specs": [
[
"==",
"6.0.1"
]
]
},
{
"name": "types-python-dateutil",
"specs": [
[
"==",
"2.9.0.20241003"
]
]
},
{
"name": "typing_extensions",
"specs": [
[
"==",
"4.12.2"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"2.2.3"
]
]
},
{
"name": "uvicorn",
"specs": [
[
"==",
"0.32.1"
]
]
},
{
"name": "uvloop",
"specs": [
[
"==",
"0.21.0"
]
]
},
{
"name": "watchdog",
"specs": [
[
"==",
"4.0.2"
]
]
},
{
"name": "watchfiles",
"specs": [
[
"==",
"1.0.0"
]
]
},
{
"name": "websockets",
"specs": [
[
"==",
"14.1"
]
]
}
],
"lcname": "fletx"
}