https://github.com/omamkaz/flet-stacked
a custom Flet control for managing multiple pages with smooth animations. It supports switching pages by key or index, next/previous navigation, and customizable transitions, making it perfect for dynamic UIs.
https://github.com/omamkaz/flet-stacked
flet navigation pages route toolkit tools
Last synced: 6 months ago
JSON representation
a custom Flet control for managing multiple pages with smooth animations. It supports switching pages by key or index, next/previous navigation, and customizable transitions, making it perfect for dynamic UIs.
- Host: GitHub
- URL: https://github.com/omamkaz/flet-stacked
- Owner: omamkaz
- License: mit
- Created: 2025-01-10T23:10:56.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-05-01T00:15:57.000Z (7 months ago)
- Last Synced: 2025-05-01T01:25:01.288Z (7 months ago)
- Topics: flet, navigation, pages, route, toolkit, tools
- Language: Python
- Homepage:
- Size: 83 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-flet - flet-stacked - a custom Flet control for managing multiple pages with smooth animations. (Uncategorized / Uncategorized)
README
# Flet Stacked v1.0.4
`Stacked` is a custom Flet control for managing multiple pages with smooth animations. It supports switching pages by key or index, next/previous navigation, and customizable transitions, making it perfect for dynamic UIs.
## Features
- Smooth Transitions: Seamlessly switch between pages with customizable animations and durations.
- Flexible Navigation: Navigate by keys, indices, or with next/previous controls for dynamic UIs.
- State Management: Easily access the current page or route for efficient state handling.
## Installation
You can install Flet Stacked using pip:
```bash
pip install git+https://github.com/omamkaz/flet-stacked.git
```
## Usage
```python
import flet as ft
from flet_stacked import Stacked
def main(page: ft.Page):
page.title = "Flet Stacked Example 1"
page.vertical_alignment = ft.MainAxisAlignment.CENTER
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
page.window.width = page.window.height = 600
routes = {
"home": ft.Text("Home Page", size=30),
"about": ft.Text("About Page", size=30),
"contact": ft.Text("Contact Page", size=30),
}
stacked = Stacked(routes, index="home", on_route_change=lambda route: print("Route: ", route))
def go_to_about(e):
stacked.switch("about")
def next_page(e):
stacked.go_next()
def prev_page(e):
stacked.go_prev()
page.add(
stacked,
ft.Row(
[
ft.ElevatedButton("Go to About", on_click=go_to_about),
ft.ElevatedButton("Next", on_click=next_page),
ft.ElevatedButton("Previous", on_click=prev_page),
]
),
)
if __name__ == "__main__":
ft.app(target=main)
```
## Output of above code
