flet-webview-all
flet-webview-all is a Flet extension that embeds web content in a Flet application. It wraps webview_all, a Flutter WebView implementation with support for Android, iOS, Linux, macOS, Windows, and the web.
The control is a ft.LayoutControl, so it can use Flet layout properties such as expand, width, height, and visible.
Installation
Install the published package from PyPI:
pip install flet-webview-all
Or add it to your application's pyproject.toml:
[project]
dependencies = [
"flet>=0.86.5",
"flet-webview-all",
]
To install the latest unreleased version directly from GitHub instead, use:
[project]
dependencies = [
"flet>=0.86.5",
"flet-webview-all @ git+https://github.com/zaim-tech/flet-webview-all.git",
]
For a local checkout during development, add the package as a path dependency instead. See the included example application for a working configuration.
Usage
import flet as ft
from flet_webview_all import FletWebviewAll
def main(page: ft.Page):
page.title = "WebView example"
page.add(
FletWebviewAll(
url="https://flet.dev",
expand=True,
)
)
ft.run(main)
Render HTML directly
Pass a complete HTML document using html. The control loads url when it is set; otherwise, it uses html.
page.add(
FletWebviewAll(
html="""
<!doctype html>
<html>
<body><h1>Hello from Flet</h1></body>
</html>
""",
expand=True,
)
)
Control properties
| Property | Type | Default | Description |
|---|---|---|---|
url |
str | None |
None |
URL to load. When set, it takes precedence over html. |
html |
str | None |
None |
Complete HTML document to render when url is not set. |
allow_navigation |
bool |
True |
Allows navigation requests from the WebView. |
zoom_enabled |
bool |
True |
Enables WebView zoom where the platform supports it. |
javascript_enabled |
bool |
True |
Enables unrestricted JavaScript execution. |
user_agent |
str | None |
None |
Overrides the WebView user-agent when provided. |
debugging_enabled |
bool |
False |
Prints JavaScript console messages through Flutter's debug logger. |
Use page.update() after changing a control property at runtime:
webview.javascript_enabled = False
page.update()
Platform support
Support is supplied by the underlying webview_all package:
| Platform | Minimum requirement / implementation |
|---|---|
| Android | API 24+ |
| iOS | 13.0+ (WKWebView) |
| Linux | webkit2gtk-4.1 |
| macOS | 10.15+ (WKWebView) |
| Windows | Windows 10 version 1809+ (WebView2) |
| Web | Modern browser |
Platform WebView engines can differ in their capabilities. Test the settings your application relies on on each target platform.
Build the example
Flet extensions include Python and Flutter code. After changing the Flutter package, rebuild the example application; Python-only changes can be run without rebuilding once the extension has been built for the target platform.
cd examples/flet_webview_all_example
flet build windows -v
Replace windows with another supported Flet build target, such as macos, apk, ipa, or web. To run the example during Python development:
flet run
Development
The project follows Flet's extension structure:
src/flet_webview_all/ Python control
src/flutter/flet_webview_all/ Flutter extension and webview_all dependency
examples/flet_webview_all_example/ Sample Flet application
docs/ Additional documentation
To add or update the Flutter dependency, work from the Flutter package directory:
cd src/flutter/flet_webview_all
flutter pub get
References
License
See LICENSE.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flet_webview_all-0.1.3.tar.gz.
File metadata
- Download URL: flet_webview_all-0.1.3.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5ef787e45e5b2dd6c10d543319cb3c3f4381c625776ecfc5aaf4eeffdfe64f3
|
|
| MD5 |
3efada87a571bf84a646ef0a63a5434a
|
|
| BLAKE2b-256 |
6311dac88a8f64ba5126494e6864f1d808b2ca206b757c10989f2d975c12adb0
|
Provenance
The following attestation bundles were made for flet_webview_all-0.1.3.tar.gz:
Publisher:
python-publish.yml on zaim-tech/flet-webview-all
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flet_webview_all-0.1.3.tar.gz -
Subject digest:
a5ef787e45e5b2dd6c10d543319cb3c3f4381c625776ecfc5aaf4eeffdfe64f3 - Sigstore transparency entry: 2341303231
- Sigstore integration time:
-
Permalink:
zaim-tech/flet-webview-all@6952f0cf1afd42e6ba8805402920a2a66f1fecb1 -
Branch / Tag:
refs/tags/0.1.3 - Owner: https://github.com/zaim-tech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@6952f0cf1afd42e6ba8805402920a2a66f1fecb1 -
Trigger Event:
release
-
Statement type:
File details
Details for the file flet_webview_all-0.1.3-py3-none-any.whl.
File metadata
- Download URL: flet_webview_all-0.1.3-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba02cf04ba652236362804a0cca25fc7722dea420567e2df1f2e851288d3ea85
|
|
| MD5 |
3e7875003a2ea6f0524db658545709f9
|
|
| BLAKE2b-256 |
ef41e77ebc37428be59764fb6e79d9d03439a16aa773cc087fb84b907b440047
|
Provenance
The following attestation bundles were made for flet_webview_all-0.1.3-py3-none-any.whl:
Publisher:
python-publish.yml on zaim-tech/flet-webview-all
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flet_webview_all-0.1.3-py3-none-any.whl -
Subject digest:
ba02cf04ba652236362804a0cca25fc7722dea420567e2df1f2e851288d3ea85 - Sigstore transparency entry: 2341303240
- Sigstore integration time:
-
Permalink:
zaim-tech/flet-webview-all@6952f0cf1afd42e6ba8805402920a2a66f1fecb1 -
Branch / Tag:
refs/tags/0.1.3 - Owner: https://github.com/zaim-tech
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@6952f0cf1afd42e6ba8805402920a2a66f1fecb1 -
Trigger Event:
release
-
Statement type: