Flet Framework

repository·main·Indexed 12 days ago

https://github.com/flet-dev/flet

A framework for building multi-platform (mobile, desktop, and web) applications using only Python. It leverages Flutter for high-performance UI rendering, enabling developers to create interfaces without HTML, CSS, or JavaScript. Features include advanced routing with nested outlets, managed view stacks, recursive routing, and modal routes for fullscreen-dialog overlays.

Tokens
277.9K
Snippets
1K
Records
1.4K
Agent score
91%

What's inside Flet

  1. Overview of the Flet Python SDK

    main

    Flet is a framework that allows you to build interactive, multi-platform applications (Web, Desktop, and Mobile) using only Python. It provides a rich set of built-in controls and services, enabling developers to create professional UIs without needing deep knowledge of frontend technologies like HTML, CSS, or JavaScript.

    Key features include:

    • Single Code Base: Write once in Python and deploy to any device.
    • Rich UI Library: Over 150 built-in controls.
    • Multi-Platform Support: Full web support, plus dedicated support for iOS and Android via specialized Python packages.
    • Built-in Packaging: Tools to package your application for distribution.
    • Extensibility: Easily extend functionality through Python.
  2. Overview of flet-geolocator features

    main

    The flet-geolocator package provides geolocation services for Flet applications, built upon the Flutter geolocator package.

    Key capabilities include:

    • Retrieving the last known location.
    • Retrieving the current location of the device.
    • Receiving continuous location updates.
    • Checking if location services are enabled on the device.
  3. Overview of flet-datatable2

    main

    flet-datatable2 is an enhanced data table component for Flet applications. It extends the built-in Flet data table by adding advanced layout features while preserving all core functionality.

    Key features include:

    • Sticky headers: Keep headers visible while scrolling.
    • Fixed top rows: Pin specific rows to the top.
    • Fixed left columns: Pin specific columns to the left.

    This package is based on the Flutter data_table_2 package.

  4. Overview of flet-permission-handler

    main

    The flet-permission-handler is a Flet extension based on the Flutter permission_handler package. It allows developers to manage device permissions within a Flet application.

    Key capabilities include:

    • Requesting permissions at runtime.
    • Checking permission status (e.g., whether a permission is granted or denied).
    • Redirecting users to system settings to manually manage permissions.
  5. Overview of flet-spinkit

    main

    flet-spinkit is a Flet extension package that provides 30 different animated loading spinner controls. It is a Python implementation based on the flutter_spinkit Flutter package, allowing you to add various loading animations to your Flet applications.

    Platform Support: This package is supported on all major platforms:

    • Windows
    • macOS
    • Linux
    • iOS
    • Android
    • Web
  6. Overview of flet-map capabilities

    main

    The flet-map extension allows you to display interactive maps in Flet apps. It is built on top of flutter_map and supports:

    • Multiple tile providers and layers.
    • Markers (including Circle, Polygon, and Polyline markers).
    • Overlays (including images and rotated images).
    • Rich attributions.

    Platform Support: Supported on Windows, macOS, Linux, iOS, Android, and Web.

  7. Use the DataTable control

    main

    The flet.DataTable control is used to display data in a tabular format. It supports various features including:

    • Basic Data Display: Organizing data into rows and columns.
    • Spacing and Layout: Controlling the flow and spacing of the table.
    • Adaptive Row Heights: Allowing row heights to adjust based on content.
    • Sorting and Selection: Making columns sortable and rows selectable.
    • Event Handling: Responding to user interactions within the table.
    import flet as ft
    
    def main(page: ft.Page):
        # Example of a basic DataTable structure
        dt = ft.DataTable(
            columns=[
                ft.DataColumn(ft.Text("Name")),
                ft.DataColumn(ft.Text("Age")),
            ],
            rows=[
                ft.DataRow(
                    cells=[
                        ft.DataCell(ft.Text("Alice")),
                        ft.DataCell(ft.Text("25")),
                    ],
                ),
            ],
        )
        page.add(dt)
    
    ft.app(target=main)
  8. Features of Flet with FastAPI

    main

    Using flet-fastapi provides several advanced capabilities for web deployment:

    • Multiple Flet apps on a single domain: Map different Flet apps to the root or specific sub-paths.
    • Flexible Routing: Use simple one-line mappings or individual endpoint configurations.
    • High Concurrency: Includes a lightweight async wrapper around FastAPI WebSocket connections.
    • Static File Serving: Serves Flet static files, including user assets and app meta-information.
    • File Handling: Includes an uploads handler for the FilePicker control.
    • Authentication: Includes an OAuth callback handler for authentication flows.