A Model-based router for Flet applications that simplifies the creation of multi-page applications
Project description
Flet Model
A Model-based router for Flet applications that simplifies the creation of multi-page applications.
Installation
pip install flet-model
Usage
Here's a simple example of how to use Flet Model:
import flet as ft
from flet_model import main, Model
class FirstView(Model):
route = 'first'
vertical_alignment = ft.MainAxisAlignment.CENTER
horizontal_alignment = ft.CrossAxisAlignment.CENTER
appbar = ft.AppBar(
title=ft.Text("First View"),
center_title=True,
bgcolor=ft.Colors.SURFACE)
controls = [
ft.ElevatedButton("Go to Second Page", on_click="go_second")
]
def go_second(self, e):
self.page.go('first/second')
class SecondView(Model):
route = 'second'
vertical_alignment = ft.MainAxisAlignment.CENTER
horizontal_alignment = ft.CrossAxisAlignment.CENTER
appbar = ft.AppBar(
title=ft.Text("Second View"),
center_title=True,
bgcolor=ft.Colors.SURFACE)
controls = [
ft.ElevatedButton("Go to First", on_click="go_first")
]
def go_first(self, e):
self.page.go('first')
# Run the Flet app
ft.app(target=main)
Features
- Model-based view definition
- Automatic route handling
- Event binding
- Support for nested routes
- Easy navigation between views
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flet_model-0.1.0.tar.gz
(7.5 kB
view details)
Built Distribution
File details
Details for the file flet_model-0.1.0.tar.gz
.
File metadata
- Download URL: flet_model-0.1.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 868892155344851191d03a3b28dee8a6dd99d64c514de88de9560fb52ce22abd |
|
MD5 | a142688898a4c000f321a11f6e206670 |
|
BLAKE2b-256 | ff44e07d733048399a1d83c54199a8ff2c77e776cfbf74ae8aaede889a65609e |
File details
Details for the file flet_model-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: flet_model-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ddc9587666e1ca8a38799551b306a49145a6ad67646b79a3b624641034fb0a2 |
|
MD5 | 219083206ae6e46c5c7b1d6db2c9fcd7 |
|
BLAKE2b-256 | b5febcd31074ae1c54159dd4f780bb0c0646f223077ed05159e6e51e599a3301 |