β¨ Welcome to FletX¶
FletX is a lightweight, modular, and reactive architectural framework built on top of Flet, designed to help you build scalable Python UI applications with clean code, structured layers, and modern development patterns.
What is FletX?¶
Inspired by frameworks like GetX in the Flutter ecosystem, FletX introduces powerful architectural patterns to Flet:
- β Reactive state management
- β Modular routing system with dynamic parameters and guards
- β Controllers and services to separate logic from UI
- β Global and local dependency injection
- β Lifecycle hooks for pages and the app
- β Unified configuration with fluent API
- β Built-in support for asynchronous programming
π§ Philosophy¶
FletX is built on 3 core principles:
- Simplicity β Focus on code clarity and maintainability
- Modularity β Encourage component-based structure and reusable logic
- Flexibility β Allow full control over your app flow, while staying non-intrusive
FletX is not a UI library. It doesnβt reinvent Fletβs widgets β it empowers you to use them better by providing a powerful and extensible application layer.
β‘ Quick Example¶
import flet as ft
from fletx.app import FletXApp
from fletx.core import (
FletXPage, FletXController, RxInt, RxStr
)
from fletx.navigation import router_config
from fletx.decorators import (
simple_reactive
)
class CounterController(FletXController):
def __init__(self):
self.count = RxInt(0)
super().__init__()
@simple_reactive(bindings={'value': 'text'})
class MyReactiveText(ft.Text):
def __init__(self, rx_text: RxStr, **kwargs):
self.text: RxStr = rx_text
super().__init__(**kwargs)
class CounterPage(FletXPage):
ctrl = CounterController()
def build(self):
return ft.Column(
controls=[
MyReactiveText(rx_text=self.ctrl.count, size=200, weight="bold"),
ft.ElevatedButton(
"Increment",
on_click=lambda e: self.ctrl.count.increment()
)
]
)
def main():
router_config.add_route(path='/', component=CounterPage)
app = FletXApp(
title="My Counter",
initial_route="/",
debug=True
).with_window_size(400, 600).with_theme(
ft.Theme(color_scheme_seed=ft.Colors.BLUE)
)
app.run()
if __name__ == "__main__":
main()
π Explore FletX¶
-
Get Started
Set up FletX and build your first UI in minutes.
-
API Reference
Complete reference for all available methods and configurations.
-
Guides
Learn routing, state, and architecture with hands-on guides.
-
Contribute
Help improve FletX with your feedback and code.
π Additional Links¶
Made with β€οΈ by AllDotPy