Skip to main content

Flet v0.25.0 Release Announcement

· 10 min read
Feodor Fitsner
Flet founder and developer

Hey Flet developers, we’ve got something exciting to share — Flet 0.25.0 is officially released!

The biggest news? No more Kivy for iOS and Android packaging. No more dealing with frustrating Python binary dependencies — Flet now uses its own custom Python runtime, so your app builds are easier than ever. Plus, we’ve added loads of new features like better permissions control, faster rebuilds, and even a lightweight Linux client that skips the bloat.

Let’s dive into all the cool stuff Flet 0.25.0 has to offer! 🚀

How to upgrade

Run the following command to upgrade Flet:

pip install 'flet[all]' --upgrade
note

[all] is an "extra" specifier which tells pip to install all flet package dependencies. See New Python packages structure section below for the explanation.

Bump flet package version to 0.25.0 (or remove it at all to use the latest) in requirements.txt or pyproject.toml.

New packaging

Flet packaging for iOS and Android has been relying on Kivy and it was super annoying when your app depends on Python binary packages, such as Numpy or Pillow. You needed to compile those packages yourself using Kivy command line tools. It was really frustrating and even hopeless if Kivy didn't have "recipes" for some packages, like Pydantic.

Flet does not depend on Kivy anymore and uses its own Python runtime "meticulously crafted in-house".

Flet packaging implementation for iOS and Androind adheres to strict specifications defined in PEP 730 (iOS) and PEP 738 (Android) which were implemented and released in Python 3.13 (and back-ported to Python 3.12). When pypi.org supports wheel tags for iOS and Android and 3rd-party Python package maintainers start uploading their mobile packages Flet will be compatible with them and you'll be able to use them in your Flet app.

Pre-built binary packages

flet build command for iOS and Android is now installing pre-built binary packages from https://pypi.flet.dev.

New packages can be built with creating a recipe in Mobile Forge project. For now, Flet team is authoring those recipes for you, but when the process is polished and fully-automated you'll be able to send a PR and test the compiled package right away.

If you don't yet see a package you require at https://pypi.flet.dev, you can request it in Flet discussions - Packages. Please do not request pure Python packages. Go to package's "Download files" section at https://pypi.org and make sure it contains binary platform-specific wheels.

Packaging behavior was changed too:

  • The packaging is not trying to replace flet dependency with flet-runtime, flet-embed or flet-pyodide, but install all dependencies "as is" from requirements.txt or pyproject.toml - thanks to the new Flet packages structure.
  • If the binary package for target platform is not found the packaging won't be trying to compile it from source distribution, but will fail instead with a meaningful error.

Python 3.12

Packaged Flet app runs on Python 3.12.7 runtime on all platforms.

Permissions

New flet build command allows granular control over permissions, features and entitlements embedded into AndroidManifest.xml, Info.plist and .entitlements files.

No more hard-coded permissions in those files!

For example, setting permissions for iOS bundle:

flet build --info-plist NSLocationWhenInUseUsageDescription="This app uses location service when in use."

or the same in pyproject.toml (read about pyproject.toml support below):

[tool.flet.ios.info] # --info-plist
NSLocationWhenInUseUsageDescription = "This app uses location service when in use."

An example of setting Android permissions and features:

flet build \
--android-permissions android.permission.READ_EXTERNAL_STORAGE=True \
android.permission.WRITE_EXTERNAL_STORAGE=True \
--android-features android.hardware.location.network=False

Read more about permissions in the docs.

Control over app compilation and cleanup

flet build command is no longer compiling app .py files into .pyc by default which allows you to defer discovery of any syntax errors in your app and complete the packaging.

You can control the compilation and cleanup with the following new options:

  • --compile-app - compile app's .py files.
  • --compile-packages - compile installed packages' .py files.
  • --cleanup-on-compile - remove unnecessary files upon successful compilation.

Signing Android bundles

We also added new options for signing Android builds:

  • --android-signing-key-store - path to an upload keystore .jks file for Android apps.
  • --android-signing-key-store-password - Android signing store password.
  • --android-signing-key-alias - Android signing key alias. Default is "upload".
  • --android-signing-key-password - Android signing key password.

Read Build and release an Android app for more information on how to configure upload key for Android builds.

Deep linking configuration

There is a new --deep-linking-url option to configure deep linking for iOS and Android builds. The value must be in the format <sheme>://<host>.

Faster re-builds

Ephemeral Flutter app created by flet build command is no longer being re-created on every build in a temp directory, but cached in build/flutter directory which gives faster re-builds, improves packaging troubleshooting and does not pollute user temp directory.

You can use --clear-cache option to do a clean build though.

Split APKs per ABI

flet build now provides the built-in --split-per-abi option to split the APKs per ABIs.

"Data" and "Temp" directories for the app

Flet developers have been asking where to store application data, such as uploaded files, SQLite databases, etc. that are persistent across application updates.

This release introduce two environment variables that are available in your Flet apps:

  • FLET_APP_STORAGE_DATA - directory for storing application data that is preserved between app updates. That directory is already pre-created and its location depends on the platform the app is running on.
  • FLET_APP_STORAGE_TEMP - directory for temporary application files, i.e. cache. That directory is already pre-created and its location depends on the platform the app is running on.

For example, data folder path can be read in your app as:

import os

# it's `None` when running the app in web mode
data_dir = os.getenv("FLET_APP_STORAGE_DATA")
note

flet run command creates data and temp directories and sets FLET_APP_STORAGE_DATA and FLET_APP_STORAGE_TEMP to their paths.

pyproject.toml support

It's inconvenient and bulky to carry all flet build settings as command line options.

In Flet 0.25.0 release is now possible to configure flet build, flet run, and flet publish settings in pyproject.toml!

Flet adds tool.flet section and sub-sections to pyproject.toml. Here's the minimal version of pyproject.toml you can put into root folder of your app:

[project]
name = "my_app"
version = "1.0.0"
description = "My first Flet project"
authors = [
{name = "John Smith", email = "[email protected]"}
]
dependencies = ["flet"]

You can also generate a starting pyproject.toml (and other files) for your project with flet create command.

New Python packages structure

We re-factored Flet Python packages and removed flet-core, flet-runtime, flet-embed orflet-pyodide packages.

The new structure avoids rewriting pip dependencies while installing flet package on various platforms. There was a problem of detecting the correct flet package to install (flet-runtime, flet-embed orflet-pyodide?) if flet was not a direct dependency in user's app.

New Flet packages:

  • flet - required for minimal Flet setup, app entry point for various platforms with core logic and controls. Installed on all platforms.
  • flet-cli - contains Flet CLI commands. Installed on desktop only.
  • flet-desktop - contains pre-built Flet "client" app binary for macOS, Windows and Linux. By default installed on macOS and Windows desktops only.
  • flet-desktop-light - contains a light-weight version (without Audio and Video controls) of Flet "client" for Linux. By default installed on Linux desktops only.
  • flet-web - contains Flet web "client" and FastAPI integration. Installed on desktop only.

Packaged Flet app contains only flet package now.

flet package extras

flet package defines the following extras that can be specified when installing Flet with pip, uv, poetry and other package manager:

  • flet[all] - installs flet, flet-cli, flet-desktop and flet-web. Recommended for development.
  • flet[cli] - installs flet and flet-cli. Can be used in CI environment for packaging only.
  • flet[web] - installs flet and flet-web. Used for deploying Flet web apps.
  • flet[desktop] - installs flet and flet-desktop. Used for desktop-only development.

New Flet install and upgrade commands

Starting from this release the development version of flet package should be installed with the following command:

pip install 'flet[all]'

Ugrading flet package:

pip install 'flet[all]' --upgrade
note

pip install flet still works too, but it will install flet package only and dependent packages will be installed on demand. For example, when you run any flet CLI command flet-cli will be installed, or when you run flet run command flet-desktop package will be installed.

"Light" client for Linux

A lightweight desktop client, without Audio and Video controls, is now installed on Linux by default. It improves initial user experience as user doesn't need to immediately deal with gstreamer (audio) and mpv (video) dependencies and Flet "just works".

Once user got some Flet experience and wants to use Video and Audio controls in their application they can install gstreamer and/or mpv and replace Flet desktop with a full version.

Uninstall "light" Flet client:

pip uninstall flet-desktop-light --yes

Install full Flet desktop client:

pip install flet-desktop

New controls

  • Mobile Ads (Banner and Interstitial) (details and example).
  • Button control (#4265) - which is just an alias for ElevatedButton control.

Breaking changes

  • Refactor Badge Control to a Dataclass; added new badge property to all controls (#4077).

Below is how to migrate:

# before
page.navigation_bar = ft.NavigationBar(
destinations=[
ft.NavigationBarDestination(
icon_content=ft.Badge(
content=ft.Icon(ft.Icons.PHONE),
text=10,
),
label="Calls",
),
]
)

# after
page.navigation_bar = ft.NavigationBar(
destinations=[
ft.NavigationBarDestination(
icon=ft.Icon(
ft.Icons.PHONE,
badge="10",
),
label="Calls",
),
]
)

Other changes

  • Added {value_length}, {max_length}, and {symbols_left} placeholders to TextField.counter_text (#4403).
  • Added --skip-flutter-doctor to build cli command (#4388).
  • WebView enhancements (#4018).
  • Map control enhancements (#3994).
  • Exposed more Theme props (#4278, #4278).
  • Exposed more properties in multiple Controls (#4105)
  • Added __contains__ methods in container-alike Controls (#4374).
  • Added a custom Markdown code theme (#4343).
  • Added barrier_color prop to dialogs (#4236).
  • Merged icon and icon_content props into icon: str | Control (#4305).
  • Migrated colors and icons variables to Enums (#4180).
  • TextField: suffix_icon, prefix_icon and icon can be Control or str (#4173).
  • Added --pyinstaller-build-args to flet pack CLI command (#4187).
  • Made SearchBar's view height adjustable; added new properties (#4039).
  • Bumped Rive version and fixed Linux app build template for rive_common.

Bug fixes

  • Fixed Icon rotation (#4384).
  • Fixed regression in Markdown.code_theme when using MarkdownCodeTheme enum (#4373).
  • Fixed Segment and NavigationBarDestination accept only string tooltips (#4326).
  • Display informative message when date has wrong format (#4019).
  • Fixed MapConfiguration.interaction_configuration is not honoured (#3976).
  • Fixed Video.jump_to() fails with negative indexes (#4294).
  • Fixed condition in AppBar.tooltip_opacity (#4280).
  • Fixed wrong type (asyncio.Future -> concurrent.futures.Future) and handle CancelledError (#4268).
  • Fixed clicking on CupertinoContextMenuAction doesn't close context menu (#3948).
  • Fixed dropdown max_menu_height (#3974).
  • Fixed prevent button style from being modified in before_update() (#4181).
  • Fixed disabling filled buttons is not visually respected (#4090).
  • when label is set, use MainAxisSize.min for the Row (#3998).
  • Fixed NavigationBarDestination.disabled has no visual effect (#4073).
  • Fixed autofill in CupertinoTextField (#4103).
  • Linechart: jsonDecode tooltip before displaying (#4069).
  • Fixed button's bgcolor, color and elevation (#4126).
  • Fixed scrolling issues on Windows (#4145).
  • Skip running flutter doctor on windows if no_rich_output is True (#4108).
  • Fixed TextField freezes on Linux Mint #4422](https://github.com/flet-dev/flet/pull/4422)).

Conclusion

Flet 0.25.0 is a huge release and your feedback is highly welcomed!

Upgrade to Flet 0.25.0, test your apps and let us know how you find the new features we added.

If you have any questions, please join Flet Discord server or create a new thread on Flet GitHub discussions.

Happy Flet-ing! 👾

pyproject.toml support for flet build command

· 5 min read
Feodor Fitsner
Flet founder and developer

The number of options for flet build command grew substantially over the time and it's been inconvenient to carry all these settings in a command line.

Today, we are excited to announce another Flet pre-release which now allows configuring app build settings in pyproject.toml!

Installing pre-release

pip install flet==0.25.0.dev3526
note

For testing purposes we suggest installing Flet pre-release in a dedicated Python virtual environment.

Building the app with pre-release

To build your app with flet build command and pre-release version of Flet make sure your requirements.txt either contains exact version specifier:

flet==0.25.0.dev3526

or --pre flag before flet dependency:

--pre
flet

Quick start

Create the following minimal pyproject.toml file in the root of your Flet app or run flet create to create a new app from template:

[project]
name = "my_app"
version = "1.0.0"
description = "My first Flet project"
authors = [
{name = "John Smith", email = "[email protected]"}
]
dependencies = ["flet==0.25.0.dev3526"]
note

With pyproject.toml, you no longer need requirements.txt. However, if a requirements.txt file exists in the app's directory, the flet build command will prioritize reading dependencies from it instead of those listed in pyproject.toml.

[project] is the standard required section of project.toml.

note

Flet also supports [tool.poetry] section created by Poetry which contains project settings.

A minimal pyproject.toml for Poetry, which is also supported by flet build command, is the following:

[tool.poetry]
name = "my_app"
version = "1.0.0"
description = "My first Flet project"
authors = ["John Smith <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.10"
flet = "0.25.0.dev3526"

project.name (or tool.poetry.name) corresponds to --project option of flet build command and it will be the name of app bundle or executable. The value of project.name will be "slugified" where all non-alphanumeric values are replaced with dashes -.

project.version (or tool.poetry.version) corresponds to --build-version option and it is a value in "x.y.z" string used as the version number shown to users.

project.description (or tool.poetry.description) corresponds to --description option which is the description to use for executable or bundle.

note

project.authors and tool.poetry.authors are not used by flet build, but required by a standard and other tools.

Overriding config with CLI options

All settings in pyproject.toml have corresponding flet build CLI options. If you run the flet build command and specify options that are already configured in pyproject.toml, the CLI option values will override those from the configuration file.

Project dependencies

List project dependencies in project.dependencies section. The value is an array with pip-like requirement specifiers:

[project]
dependencies = [
"flet==0.25.0.dev3526",
"numpy"
]

Product information

All Flet specific settings should be put into [tool.flet] section and sub-sections below it.

Product information settings complement the ones in [project] section and allows configuring app bundle identifier and product display name.

[tool.flet]
org = "com.mycompany" # --org
product = "Product name" # --product
company = "My Company" # --company
copyright = "Copyright (C) 2024 by MyCompany" # --copyright
build_number = 1 # --build-number

App package contents

The following settings control the contents of Python app archive and compilation of app/packages sources.

[tool.flet]
app.module = "main" # --module-name
app.path = "src" # path to Python app relative to `pyproject.toml`
app.exclude = ["assets"] # --exclude

compile.app = false # --compile-app
compile.packages = false # --compile-packages
compile.cleanup = false # --cleanup-on-compile

They could be alternatively written under their own sub-sections as:

[tool.flet.app]
module = "main"
path = "src"
exclude = ["assets"]

[tool.flet.compile]
app = false
packages = false
cleanup = false

Splash

[tool.flet.splash]
color = "" # --splash-color
dark_color = "" # --splash-dark-color
web = false # --no-web-splash
ios = false # --no-ios-splash
android = false # --no-android-splash

Permissions

[tool.flet]
permissions = ["camera", "microphone"] # --permissions

Deep linking

[tool.flet.deep_linking]
scheme = "https" # --deep-linking-scheme
host = "mydomain.com" # --deep-linking-host

Android settings

[tool.flet.android]
adaptive_icon_background = "" # --android-adaptive-icon-background
split_per_abi = false # --split-per-abi

Permissions (notice quotes " around key names):

[tool.flet.android.permission] # --android-permissions
"android.permission.CAMERA" = true
"android.permission.CAMERA" = true

Features (notice quotes " around key names):

[tool.flet.android.feature] # --android-features
"android.hardware.camera" = false

Android-specific deep-linking:

[tool.flet.android.deep_linking]
scheme = "https" # --deep-linking-scheme
host = "mydomain.com" # --deep-linking-host

Android bundle signing options:

[tool.flet.android.signing]
# store and key passwords can be passed with `--android-signing-key-store-password`
# and `--android-signing-key-password` options or
# FLET_ANDROID_SIGNING_KEY_STORE_PASSWORD
# and FLET_ANDROID_SIGNING_KEY_PASSWORD environment variables.
key_store = "path/to/store.jks" # --android-signing-key-store
key_alias = "upload"

iOS settings

[tool.flet.ios]
team = "team_id" # --team

[tool.flet.ios.info] # --info-plist
NSCameraUsageDescription = "This app uses the camera to ..."

[tool.flet.ios.info.deep_linking]
scheme = "https"
host = "mydomain.com"

macOS settings

[tool.flet.macos]
entitlement."com.apple.security.personal-information.photos-library" = true
[tool.flet]
build_arch = "arm64" # --arch - if arch is not specified Flet will build universal package for both arm64 and x86_64 archs

Web settings

[tool.flet.web]
base_url = "/" # --base-url
renderer = "canvaskit" # --web-renderer
use_color_emoji = false # --use-color-emoji
route_url_strategy = "path" # --route-url-strategy

Flutter settings

Dependencies

flutter.dependencies = ["flet_video", "flet_audio"] # --include-packages

or with alternative syntax with versions:

[tool.flet.flutter.dependencies]
flet_video = "1.0.0"
flet_audio = "2.0.0"

or with path to the package on your disk:

[tool.flet.flutter.dependencies.my_package]
path = "/path/to/my_package"

Extra build args

flutter.build_args = ["--some-flutter-arg"] # --flutter-build-args

Extra pubspec.yaml settings

Allows injecting arbitrary content into resulting pubspec.yaml, for example:

[tool.flet.flutter.pubspec.dependency_overrides]
web = "1.0.0"

Custom template

[tool.flet.template]
path = "gh:some-github/repo" # --template
dir = "" # --template-dir
ref = "" # --template-ref

That's it! Upgrade to Flet 0.25.0.dev3526, give this new feature and try and let us know what you think!

Cheers!

Flet new packaging pre-release

· 8 min read
Feodor Fitsner
Flet founder and developer

Flet packaging for iOS and Android has been relying on Kivy and it was super annoying when your app depends on Python binary packages, such as Numpy or Pillow. You needed to compile those packages yourself using Kivy command line tools. It was really frustrating and even hopeless if Kivy didn't have "recipes" for some packages, like Pydantic.

Kivy no more! We've just published Flet 0.25.0.dev3519 pre-release with the improved flet build command which does not use Kivy! Flet is now using its own Python runtime "meticulously crafted in-house".

Flet packaging implementation for iOS and Androind adheres to strict specifications defined in PEP 730 (iOS) and PEP 738 (Android) which were implemented and released in Python 3.13 (and back-ported to Python 3.12). When pypi.org supports wheel tags for iOS and Android and 3rd-party Python package maintainers start uploading their mobile packages Flet will be compatible with them and you'll be able to use them in your Flet app.

Installing pre-release

pip install flet==0.25.0.dev3519
note

For testing purposes we suggest installing Flet pre-release in a dedicated Python virtual environment.

Building the app with pre-release

To build your app with flet build command and pre-release version of Flet make sure your requirements.txt either contains exact version specifier:

flet==0.25.0.dev3519

or --pre flag before flet dependency:

--pre
flet

Python 3.12

Packaged Flet app runs on Python 3.12.6 runtime for all platforms.

Pre-built binary packages

flet build command for iOS and Android is now installing pre-built binary packages from https://pypi.flet.dev.

New packages can be built with creating a recipe in Mobile Forge project. For now, Flet team is authoring those recipes for you, but when the process is polished and fully-automated you'll be able to send a PR and test the compiled package right away.

If you don't yet see a package at https://pypi.flet.dev you can request it in Flet discussions - Packages. Please do not request pure Python packages. Go to package's "Download files" section at https://pypi.org and make sure it contains binary platform-specific wheels.

Packaging behavior was changed too:

  • The packaging is not trying to replace flet dependency with flet-runtime, flet-embed or flet-pyodide, but install all dependencies "as is" from requirements.txt or pyproject.toml - thanks to the new Flet packages structure (link).
  • If the binary package for target platform is not found the packaging won't be trying to compile it from source distribution, but will fail instead with a meaningful error.

New packages structure

The structure avoids rewriting pip dependencies while installing flet package on various platforms. There was a problem of detecting the correct flet package to install (flet-runtime, flet-embed orflet-pyodide?) if flet was not a direct dependency in user's app.

New Flet packages:

  • flet - required for minimal Flet setup, app entry point for various platforms. Installed on all platforms.
  • flet-core - required for minimal Flet setup, core logic and controls. Installed on all platforms.
  • flet-cli - contains Flet CLI commands. Installed on desktop only.
  • flet-desktop - contains pre-built Flet "client" app binary for macOS, Windows and Linux. By default installed on macOS and Windows desktops only.
  • flet-desktop-light - contains a light-weight version (without Audio and Video controls) of Flet "client" for Linux. By default installed on Linux desktops only.
  • flet-web - contains Flet web "client" and FastAPI integration. Installed on desktop only.

Other words, packaged Flet app contains only flet and flet-core packages.

"Light" client for Linux

A light-weight desktop client, without Audio and Video controls, is not installed on Linux by default. It improves initial user experience as user doesn't need to immediately deal with gstreamer (audio) and mpv (video) dependencies right away and Flet "just works".

Once user got some Flet experience and wants to use Video and Audio controls in their application they can install gstreamer and/or mpv and replace Flet desktop with a full version.

Uninstall "light" Flet client:

pip uninstall flet-desktop-light --yes

Install full Flet desktop client:

pip install flet-desktop==0.25.0.dev3519

Permissions

New flet build command allows granular control over permissions, features and entitlements embedded into AndroidManifest.xml, Info.plist and .entitlements files.

No more hard-coded permissions in those files!

iOS

Setting iOS permissions:

flet build --info-plist permission_1=True|False|description permission_2=True|False|description ...

For example:

flet build --info-plist NSLocationWhenInUseUsageDescription=This app uses location service when in use.

macOS

Setting macOS entitlements:

flet build --macos-entitlements name_1=True|False name_2=True|False ...

Default macOS entitlements:

  • com.apple.security.app-sandbox = False
  • com.apple.security.cs.allow-jit = True
  • com.apple.security.network.client = True
  • com.apple.security.network.server" = True

Android

Setting Android permissions and features:

flet build --android-permissions permission=True|False ... --android-features feature_name=True|False

For example:

flet build \
--android-permissions android.permission.READ_EXTERNAL_STORAGE=True \
android.permission.WRITE_EXTERNAL_STORAGE=True \
--android-features android.hardware.location.network=False

Default Android permissions:

  • android.permission.INTERNET

Default permissions can be disabled with --android-permissions option and False value, for example:

flet build --android-permissions android.permission.INTERNET=False

Default Android features:

  • android.software.leanback=False (False means it's written in manifest as android:required="false")
  • android.hardware.touchscreen=False

Cross-platform permission groups

There are pre-defined permissions that mapped to Info.plist, *.entitlements and AndroidManifest.xml for respective platforms.

Setting cross-platform permissions:

flet build --permissions permission_1 permission_2 ...

Supported permissions:

  • location
  • camera
  • microphone
  • photo_library

iOS mapping to Info.plist entries

  • location
    • NSLocationWhenInUseUsageDescription = This app uses location service when in use.
    • NSLocationAlwaysAndWhenInUseUsageDescription = This app uses location service.
  • camera
    • NSCameraUsageDescription = This app uses the camera to capture photos and videos.
  • microphone
    • NSMicrophoneUsageDescription = This app uses microphone to record sounds.
  • photo_library
    • NSPhotoLibraryUsageDescription = This app saves photos and videos to the photo library.

macOS mapping to entitlements

  • location
    • com.apple.security.personal-information.location = True
  • camera
    • com.apple.security.device.camera = True
  • microphone
    • com.apple.security.device.audio-input = True
  • photo_library
    • com.apple.security.personal-information.photos-library = True

Android mappings

  • location
    • permissions:
      • android.permission.ACCESS_FINE_LOCATION": True
      • android.permission.ACCESS_COARSE_LOCATION": True
      • android.permission.ACCESS_BACKGROUND_LOCATION": True
    • features:
      • android.hardware.location.network": False
      • android.hardware.location.gps": False
  • camera
    • permissions:
      • android.permission.CAMERA": True
    • features:
      • android.hardware.camera": False
      • android.hardware.camera.any": False
      • android.hardware.camera.front": False
      • android.hardware.camera.external": False
      • android.hardware.camera.autofocus": False
  • microphone
    • permissions:
      • android.permission.RECORD_AUDIO": True
      • android.permission.WRITE_EXTERNAL_STORAGE": True
      • android.permission.READ_EXTERNAL_STORAGE": True
  • photo_library
    • permissions:
      • android.permission.READ_MEDIA_VISUAL_USER_SELECTED": True

Control over app compilation and cleanup

flet build command is no longer compiling app .py files into .pyc by default which allows you to avoid (defer?) discovery of any syntax errors in your app and complete the packaging.

You can control the compilation and cleanup with the following new options:

  • --compile-app - compile app's .py files.
  • --compile-packages - compile installed packages' .py files.
  • --cleanup-on-compile - remove unnecessary files upon successful compilation.

Signing Android bundles

Added new options for signing Android builds:

  • --android-signing-key-store - path to an upload keystore .jks file for Android apps.
  • --android-signing-key-store-password - Android signing store password.
  • --android-signing-key-alias - Android signing key alias. Default is "upload".
  • --android-signing-key-password - Android signing key password.

Read Build and release an Android app for more information on how to configure upload key for Android builds.

"Data" and "Temp" directories for the app

Flet developers have been asking where to store application data, such as uploaded files, SQLite databases, etc. that are persistent across application updates.

This release introduce two environment variables that are available in your Flet apps:

  • FLET_APP_STORAGE_DATA - directory for storing application data that is preserved between app updates. That directory is already pre-created.
  • FLET_APP_STORAGE_TEMP - directory for temporary application files, i.e. cache. That directory is already pre-created.

For example, data folder path can be read in your app as:

import os

# it's `None` when running the app in web mode
data_dir = os.getenv("FLET_APP_STORAGE_DATA")
note

flet run command creates data and temp directories and sets FLET_APP_STORAGE_DATA and FLET_APP_STORAGE_TEMP to their paths.

Deep linking configuration

There is a new --deep-linking-url option to configure deep linking for iOS and Android builds. The value must be in the format <sheme>://<host>.

Faster re-builds

Ephemeral Flutter app created by flet build command is not re-created all the time in a temp directory, but cached in build/flutter directory which gives faster re-builds, improves packaging troubleshooting and does not pollute temp directory.

Split APKs per ABI

flet build now provides the built-in --split-per-abi option to split the APKs per ABIs.

Known pre-release issues

  • flet publish is not yet working.

What else coming in the release

We would like to include a few more things into Flet 0.25.0 release. Expect more pre-releases in the coming weeks.

pyproject.toml support

It's inconvenient and bulky to carry all flet build settings as command line options.

You will be able to store project and build settings in [tool.flet] section of pyproject.toml.

Running Flet app on simulator

We will add an option to flet build and run packaged app on a real device or simulator.

Installing Flutter

flet build will download and configure Flutter for you if there is no suitable installation available on your machine.

Flet v0.24.0 Release Announcement

· 6 min read
Henri Ndonko
Flet Contributor and Maintainer

I am very happy to announce the release of Flet version 0.24.0! It comes with a very long list of bug fixes, several enhancements and new features.

New Controls

New Properties

  • AudioRecorder: cancel_recording()
  • Video: on_completed, on_track_changed
  • InputFilter: unicode, case_sensitive, dot_all, multiline
  • Geolocator: on_error, on_position_change
  • Barchart, LineChart: tooltip_border_side, tooltip_direction, tooltip_fit_inside_horizontally, tooltip_fit_inside_vertically, tooltip_horizontal_offset, tooltip_margin, tooltip_max_content_width, tooltip_padding, tooltip_rounded_radius, tooltip_rotate_angle
  • Container: decoration, foreground_decoration, ignore_interactions, image
  • Page, View: decoration, foreground_decoration
  • CupertinoTextField: enable_scribble, image, obscuring_character, padding, scroll_padding, on_click
  • DataTable: heading_row_alignment
  • TextField: counter, disabled_hint_content, options_fill_horizontally
  • ExpansionTile: min_tile_height, show_trailing_icon
  • Markdown: fit_content, img_error_content, md_style_sheet, shrink_wrap, soft_line_break, on_selection_change
  • MenuItemButton: autofocus, overflow_axis, semantic_label
  • Tabs: label_padding, label_text_style, padding, splash_border_radius, unselected_label_text_style, on_click
  • and lot of new classes (enums, dataclasses, events)…

Enhancements

  • Better string output of Events when printed
  • Image.filter_quality now has a default of FilterQuality.MEDIUM (previously FilterQuality.LOW), which is a better default for downscaled images.
  • Geolocator control has been improved to support location streaming through the newly added on_position_change event. When defined, you will be able to "listen" to location changes as they happen.
  • When AppBar.adaptive=True and the app is running on an Apple platform, the AppBar.actions controls are now wrapped in a Row, then displayed. Before this, only the first item of AppBar.actions list was displayed.
  • The Markdown control has been significantly improved. It can now display SVG images and be much more customized.
  • A very requested feature was the ability to set a background image or gradient for the application. In #3820, we made this possible and easy to use.
  • rtl (right-to-left) property has been added to more controls (NavigationRailDestination, NavigationRail, AppBar, CupertinoAppBar, and NavigationDrawer ) to improve support for right-to-left text directions.
  • Introduced --no-rich-output flag (only in flet build command for now) to make it possible to disable rich output (mainly emojis) in the console. More information in #3708.
  • Typing has been significantly improved, particularly for event-handler properties. In modern IDEs like PyCharm and VSCode, you can now easily determine the type of an event handler's argument by simply hovering over the event in the control. Additionally, the IDE will highlight errors when you attempt to access a non-existent property on the event handler argument, ensuring more robust and error-free code.

Bug Fixes

The below issues were successfully fixed:

  • #3769: InputFilter clears the TextField text content when an invalid character is entered
  • #3770: Theme.floating_action_button_theme non existent
  • #3734: Ensure Dropdown.alignment is respected.
  • #3730: UnicodeEncodeError raised when packaging on WindowOS
  • #2160: Markdown control can't render svg images
  • #2158: Markdown broken when an image is not found
  • #3679: Broken Dismissible
  • #3670: Switch.height and Switch.width not respected
  • #3612, #3566: Broken OnScrollEvent
  • #3564: Broken TextField.capitalization
  • #3649: CupertinoPicker jumps-scroll on some platforms
  • #3557: Impeller causes blank screen on mac Intel
  • #3574: Geolocator not working on Android devices
  • #3505: WindowEventType doesn't contain fullscreen all events

Thanks to all those who reported them!

Deprecations

All deprecated items from this release will be removed in version 0.27.0.

  • ThemeVisualDensity is deprecated and has been renamed to VisualDensity
  • CupertinoButton: disabled_color is deprecated and has been renamed to disabled_bgcolor, which better reflects its use
  • Markdown: code_style is deprecated and should now be accessed as code_style_sheet.code_text_style
  • Container: image_fit, image_opacity, image_repeat, image_src and image_src_base64 are deprecated and should now be accessed from image which is of type DecorationImage

Breaking Changes and Migration

Tooltip

The Tooltip class is no more a Flet control and is from now on a simple Python dataclass. The tooltip property (available in almost all controls) now supports both strings and Tooltip objects.

Below is how to migrate:

# before
page.add(
ft.Tooltip(
message="This is tooltip",
content=ft.Text("Hover to see tooltip"),
padding=20,
border_radius=10,
)
)

# after
page.add(
ft.Text(
"Hover to see tooltip",
tooltip=ft.Tooltip(
message="This is tooltip",
padding=20,
border_radius=10,
)
)
)

TextField InputFilter

We modified how InputFilter.regex_string is internally handled. As a result of this, you (might) now have to anchor your regex pattern. This simply implies using start (^) and end ($) regex anchors. For example: r"[0-9]" now becomes r"^[0-9]$". Using this new string will lead work as expected and only numbers/digits will be allowed, but you might notice another issue: the last character of the text field cannot be deleted. To resolve this, you need to add an asterisk (*) in the regex which in this case will simply mean "match zero or more digits (including an empty string)". The new regex now becomes r"^[0-9]*$". To ease this migration, you can use an AI tool with the following simple prompt: "update the following regex pattern: #### ensuring that the entire string matches the pattern and it allows for an empty string".

Event-Handler subscription

The possibility to "subscribe" more than one callback to an event handler has been removed, as this was somehow biased (was only possible on some, and not all). Below is a simple example:

import flet as ft

def main(page: ft.Page):
def print_one(e):
print("1")
def print_two(e):
print("2")
def print_three(e):
print("3")
c = ft.Container(
bgcolor=ft.Colors.random_color(),
width=300,
height=300,
)

# subscribe callbacks
c.on_tap_down = print_one
c.on_tap_down = print_two
c.on_tap_down = print_three
page.add(c)

ft.app(main)

In the above code, we subscribe multiple callbacks to the Container.on_tap_down event. Prior to Flet version 0.24.0, running this code and tapping on the Container, you will see all the callbacks getting called ("1", "2" and "3" are printed out). From Flet version 0.24.0 going forward, one event = one callback. Meaning only the lastly subscribed callback will get executed ("3" is printed out) So, if you still want the final output to resemble the first one you can simply create one callback which calls the others:


def main(page: ft.Page):
#....

def print_all(e):
print_one(e)
print_two(e)
print_three(e)

c = ft.Container(
bgcolor=ft.Colors.random_color(),
width=300,
height=300,
on_tap_down=print_all,
)

# OR
c.on_tap_down = print_all

Conclusion

As you can see, we made a lot of changes in this release and as usual, your feedback is highly welcomed!

Upgrade to Flet 0.24.0, test your apps and let us know how you find the new features we added. If you have any questions, please join Flet Discord server or create a new thread on Flet GitHub discussions.

Happy Flet-ing! 👾

Flet v0.23.0 Release Announcement

· 3 min read
Henri Ndonko
Flet Contributor and Maintainer

We are excited to announce the release of Flet 0.23.0. It is a big release with many new features and bug fixes.

New Controls

New Properties

Error Handling

PEP 20 (Zen of Python): Errors should never pass silently.

Several devs reported that, on some occasions, a control might visually break without clear information on what caused the break.

For example, in issue #3149, @base-13 mentioned that "in a DataTable if the number of columns is less than the number of datacells in any row it will grey out whole table without throwing error".

Knowing this, we added more assertion-checks in most of the controls, such that, when you provide them with a wrong value, an AssertionError is raised with a very clear message of what was wrongly done.

If you find out that some checks are still missing, please point them out so they can be addressed.

Command Line (CLI) Output

The output of the flet build command has been prettified.

Also, a new option has been added --show-platform-matrix which displays a table containing the build platform matrix, which has header columns "Command" (possible build commands) and "Platform" (the device you should use with the respective command).

Furthermore, when the targeted platform can't be built on your device, a table displaying the build platform matrix is shown with an informative message.

Breaking Changes

While doing "Error Handling" mentioned above, we had to mark some important properties as required.

The following properties are now "required" (must be provided and visible) when creating an instance of their classes:

Bug Fixes

The below issues were successfully fixed:

  • #3144: ScrollbarTheme.thickness value not respected when not interacting with
  • #3072: High-resolution videos play laggy on Android TV devices.
  • #3023: (Regression) Some LineChart colors not visually respected
  • #2989: Color of Dropdown when disabled doesn't reflect its disabled state
  • #1753: Markdown code block not selectable
  • #3097: Hot-reload occurs when a file is opened
  • #1647: Container.theme_mode not honoured when Container.theme=None
  • #3064: Container.on_tap_down not called when Container.on_click=None

Special Thanks to the dynamic Flet community for reporting all the issues they encountered. We keep working hard on solving the remaining ones.

Deprecations

  • All the Page.window_*** properties are now deprecated and moved to Page.window property, which is of type Window. To migrate, simply use change window_ to window. as seen below:

    # before 
    page.window_height = 200
    page.on_window_event = lambda e: print(e.type)

    # now
    page.window.height = 200
    page.window.on_event = lambda e: print(e.type)
  • SafeArea.minimum is deprecated and has been renamed to minimum_padding

  • MaterialState enum is deprecated and has been renamed to ControlState

  • NavigationDestination is deprecated and has been renamed to NavigationBarDestination

Also, the deprecation policy has been modified. While Flet is pre-1.0, all deprecations will be removed from the API after the next 3 releases. So the above deprecations made in v0.23.0 (and all the other deprecations made in the previous versions), will be removed in v0.26.0.

That's it! :)

Upgrade to Flet 0.23.0, test your apps and let us know how you find the new features we added. If you have any questions, please join Flet Discord server or create a new thread on Flet GitHub discussions.

Happy Flet-ing!