Skip to main content

Simple routing for the Flet framework.

Project description

FletRT


A really simple routing solution for the Flet framework, developed mainly for personal use.

Please note that this project is still incomplete and lacks many features available on flet.

Sample usage:


main.py:

import flet as ft
from fletrt import Router


def main(page: ft.Page):
    Router(page, routes={
        '/page-a': PageA(),
        '/page-b': PageB()
    }, starting_route='/page-a')


ft.app(target=main)

page_a.py:

import flet as ft
from fletrt import RouteView

class PageA(RouteView):
    def body(self) -> ft.Container:

        return ft.Container(
            ft.Column(
                controls=[
                    ft.Text("Hello World, from Page A!"),
                    ft.ElevatedButton("Go to Page B", on_click=lambda _: self._page.go('/page-b'))
                ]
            )
        )

page_b.py:

import flet as ft
from fletrt import RouteView

class PageB(RouteView):
    def body(self) -> ft.Container:

        return ft.Container(
            ft.Column(
                controls=[
                    ft.Text("Hello World, from Page B!"),
                ]
            )
        )

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fletrt-0.0.1.tar.gz (5.7 kB view hashes)

Uploaded Source

Built Distribution

fletrt-0.0.1-py3-none-any.whl (6.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page