|
1 | | -# WebView control for Flet |
| 1 | +# flet-webview |
2 | 2 |
|
3 | | -`WebView` control for Flet. |
| 3 | +[](https://pypi.python.org/pypi/flet-webview) |
| 4 | +[](https://pepy.tech/project/flet-webview) |
| 5 | +[](https://github.com/flet-dev/flet-webview/blob/main/LICENSE) |
4 | 6 |
|
5 | | -## Usage |
| 7 | +A [Flet](https://flet.dev) extension for displaying web content in a WebView. |
6 | 8 |
|
7 | | -Add `flet-webview` as dependency (`pyproject.toml` or `requirements.txt`) to your Flet project. |
| 9 | +It is based on the [webview_flutter](https://pub.dev/packages/webview_flutter) |
| 10 | +and [webview_flutter_web](https://pub.dev/packages/webview_flutter_web) Flutter packages. |
8 | 11 |
|
9 | | -## Example |
| 12 | +## Documentation |
10 | 13 |
|
11 | | -```py |
| 14 | +Detailed documentation to this package can be found [here](https://flet-dev.github.io/flet-webview/). |
12 | 15 |
|
13 | | -import flet as ft |
| 16 | +## Platform Support |
14 | 17 |
|
15 | | -import flet_webview as fwv |
| 18 | +This package supports the following platforms: |
16 | 19 |
|
17 | | -def main(page: ft.Page): |
18 | | - wv = fwv.WebView( |
19 | | - url="https://flet.dev", |
20 | | - on_page_started=lambda _: print("Page started"), |
21 | | - on_page_ended=lambda _: print("Page ended"), |
22 | | - on_web_resource_error=lambda e: print("Page error:", e.data), |
23 | | - expand=True, |
24 | | - ) |
25 | | - page.add(wv) |
| 20 | +| Platform | Supported | |
| 21 | +|----------|:---------:| |
| 22 | +| Windows | ❌ | |
| 23 | +| macOS | ✅ | |
| 24 | +| Linux | ❌ | |
| 25 | +| iOS | ✅ | |
| 26 | +| Android | ✅ | |
| 27 | +| Web | ✅ | |
26 | 28 |
|
27 | | -ft.app(main) |
28 | | -``` |
| 29 | +## Installation |
| 30 | + |
| 31 | +To install the `flet-webview` package and add it to your project dependencies: |
| 32 | + |
| 33 | +- Using `uv`: |
| 34 | + ```bash |
| 35 | + uv add flet-webview |
| 36 | + ``` |
| 37 | + |
| 38 | +- Using `pip`: |
| 39 | + ```bash |
| 40 | + pip install flet-webview |
| 41 | + ``` |
| 42 | + After this, you will have to manually add this package to your `requirements.txt` or `pyproject.toml`. |
| 43 | + |
| 44 | +- Using `poetry`: |
| 45 | + ```bash |
| 46 | + poetry add flet-webview |
| 47 | + ``` |
| 48 | + |
| 49 | +## Examples |
| 50 | + |
| 51 | +For examples, see [this](./examples) |
0 commit comments