Skip to main content

Flet-Easy is a package created as a Flet add-on, designed to be easy to use with a cleaner order in the code, having many customizable features.

Project description

githubpypi

pdm-managed

logo

🔥Flet-Easy

Flet-Easy is a package built as an add-on for Flet, designed for beginners what it does is to make Flet easier when building your apps, with a tidier and simpler code. Some functions:

  • Facilitates the handling of flet events.
  • Page building using decorators, which allows you to make numerous custom configurations to flet for desktop, mobile and website application.
  • Designed to work with numerous pages of your created application.
  • Provides better MVC construction of your code, which can be scalable and easy to read.
  • Not only limits the MVC model but you can customize it according to your preferences.
  • Customized URLs for more precision in sending data.
  • Support asynchronous.
  • Supports Application Packaging for distribution.

📌Flet events it handles

  • on_route_change : Dynamic routing
  • on_view_pop
  • on_keyboard_event
  • on_resize
  • on_error

📌Form of use:

  • Installation view
  • Flet-Easy app example view
  • How to use Flet-Easy? view
  • How to create a new page? view
  • Using dynamic routes view
  • Add pages from other files to the main application. view
  • Adding pages to the main app without using decorators view
  • Customized app configuration view
    • Route protection view
    • Add general settings in the app. view
    • Add settings of the View controller of Flet view
    • Add a custom page, which will be activated when a page (path) is not found. view
    • Configure custom events view
  • Events configured by Flet-Easy. view
    • Use on_keyboard_event view
    • Use on_resize view
  • Class ResponsiveControlsy view
  • Run the app view
  • Working with other apps and creating apis view
  • Code examples view

💻Installation:

Requires installation for use:

  • Flet (Installed automatically)
  • Flet-fastapi (Optional)
  • uvicorn (Optional)
  pip install flet-easy

💻Update:

  pip install flet-easy --upgrade

🔥Flet-Easy app example

Here is an example of an application with 2 pages, "Home" and "Counter":

import flet as ft
import flet_easy as fs

app = fs.FletEasy(route_init="/flet-easy")

# We add a page
@app.page(route="/flet-easy")
def index_page(data: fs.Datasy):
    page = data.page

    page.title = "Flet-Easy"

    def go_counter(e):
        page.go("/counter")

    return ft.View(
        route="/flet-easy",
        controls=[
            ft.Text("Home page"),
            ft.FilledButton("Go to Counter", on_click=go_counter),
        ],
        vertical_alignment=ft.MainAxisAlignment.CENTER,
        horizontal_alignment=ft.CrossAxisAlignment.CENTER,
    )

# We add a second page
@app.page(route="/counter")
def counter_page(data: fs.Datasy):
    page = data.page

    page.title = "Counter"

    txt_number = ft.TextField(value="0", text_align="right", width=100)

    def minus_click(e):
        txt_number.value = str(int(txt_number.value) - 1)
        page.update()

    def plus_click(e):
        txt_number.value = str(int(txt_number.value) + 1)
        page.update()

    def go_home(e):
        page.go("/flet-easy")

    return ft.View(
        route="/counter",
        controls=[
            ft.Row(
                [
                    ft.IconButton(ft.icons.REMOVE, on_click=minus_click),
                    txt_number,
                    ft.IconButton(ft.icons.ADD, on_click=plus_click),
                ],
                alignment="center",
            ),
            ft.FilledButton("Go to Home", on_click=go_home),
        ],
        vertical_alignment=ft.MainAxisAlignment.CENTER,
        horizontal_alignment=ft.CrossAxisAlignment.CENTER,
    )

# We run the application
app.run()

🔎 More information here

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

flet_easy-0.1.0.tar.gz (1.9 MB view hashes)

Uploaded Source

Built Distribution

flet_easy-0.1.0-py3-none-any.whl (20.2 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