Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/python/packages/flet-ads/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![pypi](https://img.shields.io/pypi/v/flet-ads.svg)](https://pypi.python.org/pypi/flet-ads)
[![downloads](https://static.pepy.tech/badge/flet-ads/month)](https://pepy.tech/project/flet-ads)
[![license](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-ads.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-ads/LICENSE)
[![license](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-ads/LICENSE)

Display Google Ads in [Flet](https://flet.dev) apps.

Expand Down
2 changes: 1 addition & 1 deletion sdk/python/packages/flet-audio-recorder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![pypi](https://img.shields.io/pypi/v/flet-audio-recorder.svg)](https://pypi.python.org/pypi/flet-audio-recorder)
[![downloads](https://static.pepy.tech/badge/flet-audio-recorder/month)](https://pepy.tech/project/flet-audio-recorder)
[![license](https://img.shields.io/github/license/flet-dev/flet.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-audio-recorder/LICENSE)
[![license](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-audio-recorder/LICENSE)

Adds audio recording support to [Flet](https://flet.dev) apps.

Expand Down
13 changes: 12 additions & 1 deletion sdk/python/packages/flet-audio/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![pypi](https://img.shields.io/pypi/v/flet-audio.svg)](https://pypi.python.org/pypi/flet-audio)
[![downloads](https://static.pepy.tech/badge/flet-audio/month)](https://pepy.tech/project/flet-audio)
[![license](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-audio.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-audio/LICENSE)
[![license](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-audio/LICENSE)

A [Flet](https://flet.dev) extension package for playing audio.

Expand Down Expand Up @@ -35,6 +35,17 @@ To install the `flet-audio` package and add it to your project dependencies:
```
After this, you will have to manually add this package to your `requirements.txt` or `pyproject.toml`.

> [!NOTE]
> On Linux/WSL, you need to install [`GStreamer`](https://github.com/GStreamer/gstreamer) library.
>
> If you receive `error while loading shared libraries: libgstapp-1.0.so.0`, it means `GStreamer` is not installed in your WSL environment.
>
> To install it, run the following command:
>
> ```bash
> apt install -y libgstreamer1.0-0 gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools
> ```

### Examples

For examples, see [these](https://github.com/flet-dev/flet/tree/main/sdk/python/examples/controls/audio).
2 changes: 1 addition & 1 deletion sdk/python/packages/flet-charts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![pypi](https://img.shields.io/pypi/v/flet-charts.svg)](https://pypi.python.org/pypi/flet-charts)
[![downloads](https://static.pepy.tech/badge/flet-charts/month)](https://pepy.tech/project/flet-charts)
[![license](https://img.shields.io/github/license/flet-dev/flet.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-charts/LICENSE)
[![license](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-charts/LICENSE)

A [Flet](https://flet.dev) extension for creating interactive charts and graphs.

Expand Down
18 changes: 4 additions & 14 deletions sdk/python/packages/flet-datatable2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![pypi](https://img.shields.io/pypi/v/flet-datatable2.svg)](https://pypi.python.org/pypi/flet-datatable2)
[![downloads](https://static.pepy.tech/badge/flet-datatable2/month)](https://pepy.tech/project/flet-datatable2)
[![license](https://img.shields.io/github/license/flet-dev/flet.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-datatable2/LICENSE)
[![license](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-datatable2/LICENSE)

An enhanced data table for [Flet](https://flet.dev) apps that builds on the built-in component by adding sticky headers,
fixed top rows, and fixed left columns while preserving all core features.
Expand All @@ -17,14 +17,9 @@ You can find its documentation [here](https://docs.flet.dev/datatable2/).

This package supports the following platforms:

| Platform | Supported |
|----------|:---------:|
| Windows | ✅ |
| macOS | ✅ |
| Linux | ✅ |
| iOS | ✅ |
| Android | ✅ |
| Web | ✅ |
| Platform | Windows | macOS | Linux | iOS | Android | Web |
|----------|---------|-------|-------|-----|---------|-----|
| Supported| ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |

## Usage

Expand All @@ -43,11 +38,6 @@ To install the `flet-datatable2` package and add it to your project dependencies
```
After this, you will have to manually add this package to your `requirements.txt` or `pyproject.toml`.

- Using `poetry`:
```bash
poetry add flet-datatable2
```

### Examples

For examples, see [these](https://github.com/flet-dev/flet/tree/main/examples/controls/datatable2).
2 changes: 1 addition & 1 deletion sdk/python/packages/flet-flashlight/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![pypi](https://img.shields.io/pypi/v/flet-flashlight.svg)](https://pypi.python.org/pypi/flet-flashlight)
[![downloads](https://static.pepy.tech/badge/flet-flashlight/month)](https://pepy.tech/project/flet-flashlight)
[![license](https://img.shields.io/github/license/flet-dev/flet.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-flashlight/LICENSE)
[![license](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-flashlight/LICENSE)

A [Flet](https://flet.dev) extension to manage the device torch/flashlight.

Expand Down
4 changes: 1 addition & 3 deletions sdk/python/packages/flet-geolocator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![pypi](https://img.shields.io/pypi/v/flet-geolocator.svg)](https://pypi.python.org/pypi/flet-geolocator)
[![downloads](https://static.pepy.tech/badge/flet-geolocator/month)](https://pepy.tech/project/flet-geolocator)
[![license](https://img.shields.io/github/license/flet-dev/flet.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-geolocator/LICENSE)
[![license](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-geolocator/LICENSE)

Adds geolocation capabilities to your [Flet](https://flet.dev) apps.

Expand All @@ -14,8 +14,6 @@ Features include:

It is based on the [geolocator](https://pub.dev/packages/geolocator) Flutter package.

> **Important:** Add the `Geolocator` instance to `page.services` before invoking its methods.

## Documentation

Detailed documentation to this package can be found [here](https://docs.flet.dev/geolocator/).
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/packages/flet-lottie/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![pypi](https://img.shields.io/pypi/v/flet-lottie.svg)](https://pypi.python.org/pypi/flet-lottie)
[![downloads](https://static.pepy.tech/badge/flet-lottie/month)](https://pepy.tech/project/flet-lottie)
[![license](https://img.shields.io/github/license/flet-dev/flet.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-lottie/LICENSE)
[![license](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-lottie/LICENSE)

A [Flet](https://flet.dev) extension package for displaying Lottie animations.

Expand Down
2 changes: 1 addition & 1 deletion sdk/python/packages/flet-map/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![pypi](https://img.shields.io/pypi/v/flet-map.svg)](https://pypi.python.org/pypi/flet-map)
[![downloads](https://static.pepy.tech/badge/flet-map/month)](https://pepy.tech/project/flet-map)
[![license](https://img.shields.io/github/license/flet-dev/flet.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-map/LICENSE)
[![license](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-map/LICENSE)

A [Flet](https://flet.dev) extension for displaying interactive maps.

Expand Down
2 changes: 1 addition & 1 deletion sdk/python/packages/flet-permission-handler/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![pypi](https://img.shields.io/pypi/v/flet-permission-handler.svg)](https://pypi.python.org/pypi/flet-permission-handler)
[![downloads](https://static.pepy.tech/badge/flet-permission-handler/month)](https://pepy.tech/project/flet-permission-handler)
[![license](https://img.shields.io/github/license/flet-dev/flet.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-permission-handler/LICENSE)
[![license](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-permission-handler/LICENSE)

A [Flet](https://flet.dev) extension that simplifies working with device permissions.

Expand Down
2 changes: 1 addition & 1 deletion sdk/python/packages/flet-rive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![pypi](https://img.shields.io/pypi/v/flet-rive.svg)](https://pypi.python.org/pypi/flet-rive)
[![downloads](https://static.pepy.tech/badge/flet-rive/month)](https://pepy.tech/project/flet-rive)
[![license](https://img.shields.io/github/license/flet-dev/flet.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-rive/LICENSE)
[![license](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-rive/LICENSE)

A cross-platform [Flet](https://flet.dev) extension for displaying [Rive](https://rive.app/) animations.

Expand Down
16 changes: 15 additions & 1 deletion sdk/python/packages/flet-video/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![pypi](https://img.shields.io/pypi/v/flet-video.svg)](https://pypi.python.org/pypi/flet-video)
[![downloads](https://static.pepy.tech/badge/flet-video/month)](https://pepy.tech/project/flet-video)
[![license](https://img.shields.io/github/license/flet-dev/flet.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-video/LICENSE)
[![license](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-video/LICENSE)

A cross-platform video player for [Flet](https://flet.dev) apps.

Expand Down Expand Up @@ -35,6 +35,20 @@ To install the `flet-video` package and add it to your project dependencies:
```
After this, you will have to manually add this package to your `requirements.txt` or `pyproject.toml`.

> [!NOTE]
> To play video on Linux/WSL you need to install [`libmpv`](https://github.com/mpv-player/mpv) library:
>
> ```bash
> sudo apt update
> sudo apt install libmpv-dev libmpv2
> ```
>
> If you encounter `libmpv.so.1` load errors, run:
>
> ```bash
> sudo ln -s /usr/lib/x86_64-linux-gnu/libmpv.so /usr/lib/libmpv.so.1
> ```

### Examples

For examples, see [these](https://github.com/flet-dev/flet/tree/main/sdk/python/examples/controls/video).
2 changes: 1 addition & 1 deletion sdk/python/packages/flet-webview/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![pypi](https://img.shields.io/pypi/v/flet-webview.svg)](https://pypi.python.org/pypi/flet-webview)
[![downloads](https://static.pepy.tech/badge/flet-webview/month)](https://pepy.tech/project/flet-webview)
[![license](https://img.shields.io/github/license/flet-dev/flet.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-webview/LICENSE)
[![license](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://github.com/flet-dev/flet/blob/main/sdk/python/packages/flet-webview/LICENSE)

A [Flet](https://flet.dev) extension for displaying web content in a WebView.

Expand Down
4 changes: 2 additions & 2 deletions sdk/python/packages/flet/docs/audio/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ pip install flet-audio # (1)!
--8<-- "{{ examples }}/example_1.py"
```

/// admonition | Windows Subsystem for Linux (WSL)
/// admonition | Linux/WSL (Windows Subsystem for Linux)
type: note
On WSL, you need to install [`GStreamer`](https://github.com/GStreamer/gstreamer) library.
To play audio on Linux/WSL you need to install [`GStreamer`](https://github.com/GStreamer/gstreamer) library.

If you receive `error while loading shared libraries: libgstapp-1.0.so.0`,
it means `GStreamer` is not installed in your WSL environment.
Expand Down
3 changes: 0 additions & 3 deletions sdk/python/packages/flet/docs/charts/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ pip install flet-charts # (1)!
1. After this, you will have to manually add this package to your `requirements.txt` or `pyproject.toml`.
///

> [!TIP]
> All chart services are regular controls—simply instantiate them and add to the page or to a layout container.

## Available Charts

- [`BarChart`](bar_chart.md)
Expand Down
3 changes: 0 additions & 3 deletions sdk/python/packages/flet/docs/lottie/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ pip install flet-lottie # (1)!
1. After this, you will have to manually add this package to your `requirements.txt` or `pyproject.toml`.
///

> [!TIP]
> `Lottie` is a visual control—place it wherever any other widget goes and configure playback via its properties.

## Example

```python
Expand Down
3 changes: 2 additions & 1 deletion sdk/python/packages/flet/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ dependencies = [
"oauthlib >=3.2.2; platform_system != 'Pyodide'",
"httpx >=0.28.1; platform_system != 'Pyodide'",
"repath >=0.9.0",
"msgpack >=1.1.0"
"msgpack >=1.1.0",
"typing-extensions; python_version < '3.11'"
]

[project.urls]
Expand Down
19 changes: 8 additions & 11 deletions sdk/python/packages/flet/src/flet/controls/base_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
logger = logging.getLogger("flet")
controls_log = logging.getLogger("flet_controls")

# Try importing `dataclass_transform()` for Python 3.11+, else use a no-op function
if sys.version_info >= (3, 11): # Only use it for Python 3.11+
if sys.version_info >= (3, 11):
from typing import dataclass_transform
else:

def dataclass_transform(): # No-op decorator for older Python versions
return lambda x: x
from typing_extensions import dataclass_transform


if TYPE_CHECKING:
Expand Down Expand Up @@ -236,9 +233,9 @@ def will_unmount(self):
def update(self) -> None:
if hasattr(self, "_frozen"):
raise Exception("Frozen control cannot be updated.")
assert self.page, (
f"{self.__class__.__qualname__} Control must be added to the page first"
)
assert (
self.page
), f"{self.__class__.__qualname__} Control must be added to the page first"
self.page.update(self)

async def _invoke_method(
Expand All @@ -247,9 +244,9 @@ async def _invoke_method(
arguments: Optional[dict[str, Any]] = None,
timeout: Optional[float] = None,
) -> Any:
assert self.page, (
f"{self.__class__.__qualname__} Control must be added to the page first"
)
assert (
self.page
), f"{self.__class__.__qualname__} Control must be added to the page first"

return await self.page.session.invoke_method(
self._i, method_name, arguments, timeout
Expand Down