By means of functions¶
Adding pages to the main app without using decorators¶
For this we will require the add_routes method of the object created by the FletEasy class.
Soporta async
App structure¶

Example using functions¶
index.py
import flet_easy as fs
import flet as ft
def page_index(data: fs.Datasy):
    data.page.title = "index"
    return ft.View(
        controls=[
            ft.Text('Index'),
            ft.filledButton(
                "Go to test",
                key="/test",
                on_click=data.go
                ),
        ],
        vertical_alignment="center",
        horizontal_alignment="center"
    )
test.py
import flet_easy as fs
import flet as ft
def page_test(data: fs.Datasy):
    data.page.title = "Test"
    return ft.View(
        controls=[
            ft.Text('Test'),
            ft.Text(f'Id: {self.id}'),
            ft.Text(f'Name: {self.name}'),
            ft.FilledButton(
                        "Go index",
                        key="/index",
                        on_click=data.go,
                    ),
        ],
        vertical_alignment="center",
        horizontal_alignment="center"
)
Add routes¶
We import the functions or classes from the views folder, then we use the add_routes method of the FletEasy instance, in which we will add a list of Pagesy classes where we will configure the routes and the functions or classes to be used in addition to others.
main.py
import flet_easy as fs
import flet as ft
# Import functions from a `views` folder
from views.user import users
from views.index import page_index
from views.test import page_test
app = fs.FletEasy(
    route_init="/index"
)
# Add routes without the use of decorators
app.add_routes(add_views=[
    fs.Pagesy('/index', page_index),
    fs.Pagesy('/user/task', page_users),
    fs.Pagesy(
              '/test/{id:d}/user/{name:l}',
              page_test,
              protected_route=True
            ),
])
app.run(view=ft.AppView.WEB_BROWSER)
Pagesy¶
📑 The class Pagesy, it requires the following parameters:
In version 0.1.0 protected_route is proctect_route
share_data is available from version 0.1.3
route: text string of the url, for example('/index').view: Stores the page function.clear: Removes the pages from thepage.viewslist of flet. (optional)share_data: It is a boolean value, which is useful if you want to share data between pages, in a morerestricted way. (optional) [See more]protected_route: Protects the route of the page, according to the configuration of thelogindecoratorof theFletEasyclass. (optional) [See more]custom_params: To add validation of parameters in the custom url using a dictionary, where the key is the nameof the parameter validation and the value is the custom function that must report a boolean value. [See more]