flet-webview-all 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: flet-webview-all
3
+ Version: 0.1.1
4
+ Summary: FletWebviewAll control for Flet
5
+ Author-email: Flet contributors <you@example.com>
6
+ Project-URL: Homepage, https://mydomain.dev
7
+ Project-URL: Documentation, https://github.com/MyGithubAccount/flet-webview-all
8
+ Project-URL: Repository, https://github.com/MyGithubAccount/flet-webview-all
9
+ Project-URL: Issues, https://github.com/MyGithubAccount/flet-webview-all/issues
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: flet>=0.86.5
13
+
14
+ # flet-webview-all
15
+
16
+ `flet-webview-all` is a Flet extension that embeds web content in a Flet application. It wraps [`webview_all`](https://pub.dev/packages/webview_all), a Flutter WebView implementation with support for Android, iOS, Linux, macOS, Windows, and the web.
17
+
18
+ The control is a `ft.LayoutControl`, so it can use Flet layout properties such as `expand`, `width`, `height`, and `visible`.
19
+
20
+ ## Installation
21
+
22
+ Add this Git dependency to your application's `pyproject.toml`:
23
+
24
+ ```toml
25
+ [project]
26
+ dependencies = [
27
+ "flet>=0.86.5",
28
+ "flet-webview-all @ git+https://github.com/zaim-tech/flet-webview-all.git",
29
+ ]
30
+ ```
31
+
32
+ Then install the project dependencies with your preferred package manager, for example:
33
+
34
+ ```bash
35
+ pip install .
36
+ ```
37
+
38
+ For a local checkout during development, add the package as a path dependency instead. See the included [example application](examples/flet_webview_all_example/) for a working configuration.
39
+
40
+ ## Usage
41
+
42
+ ```python
43
+ import flet as ft
44
+
45
+ from flet_webview_all import FletWebviewAll
46
+
47
+
48
+ def main(page: ft.Page):
49
+ page.title = "WebView example"
50
+ page.add(
51
+ FletWebviewAll(
52
+ url="https://flet.dev",
53
+ expand=True,
54
+ )
55
+ )
56
+
57
+
58
+ ft.run(main)
59
+ ```
60
+
61
+ ### Render HTML directly
62
+
63
+ Pass a complete HTML document using `html`. The control loads `url` when it is set; otherwise, it uses `html`.
64
+
65
+ ```python
66
+ page.add(
67
+ FletWebviewAll(
68
+ html="""
69
+ <!doctype html>
70
+ <html>
71
+ <body><h1>Hello from Flet</h1></body>
72
+ </html>
73
+ """,
74
+ expand=True,
75
+ )
76
+ )
77
+ ```
78
+
79
+ ## Control properties
80
+
81
+ | Property | Type | Default | Description |
82
+ | --- | --- | --- | --- |
83
+ | `url` | `str \| None` | `None` | URL to load. When set, it takes precedence over `html`. |
84
+ | `html` | `str \| None` | `None` | Complete HTML document to render when `url` is not set. |
85
+ | `allow_navigation` | `bool` | `True` | Allows navigation requests from the WebView. |
86
+ | `zoom_enabled` | `bool` | `True` | Enables WebView zoom where the platform supports it. |
87
+ | `javascript_enabled` | `bool` | `True` | Enables unrestricted JavaScript execution. |
88
+ | `user_agent` | `str \| None` | `None` | Overrides the WebView user-agent when provided. |
89
+ | `debugging_enabled` | `bool` | `False` | Prints JavaScript console messages through Flutter's debug logger. |
90
+
91
+ Use `page.update()` after changing a control property at runtime:
92
+
93
+ ```python
94
+ webview.javascript_enabled = False
95
+ page.update()
96
+ ```
97
+
98
+ ## Platform support
99
+
100
+ Support is supplied by the underlying [`webview_all`](https://pub.dev/packages/webview_all) package:
101
+
102
+ | Platform | Minimum requirement / implementation |
103
+ | --- | --- |
104
+ | Android | API 24+ |
105
+ | iOS | 13.0+ (`WKWebView`) |
106
+ | Linux | `webkit2gtk-4.1` |
107
+ | macOS | 10.15+ (`WKWebView`) |
108
+ | Windows | Windows 10 version 1809+ (`WebView2`) |
109
+ | Web | Modern browser |
110
+
111
+ Platform WebView engines can differ in their capabilities. Test the settings your application relies on on each target platform.
112
+
113
+ ## Build the example
114
+
115
+ 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.
116
+
117
+ ```bash
118
+ cd examples/flet_webview_all_example
119
+ flet build windows -v
120
+ ```
121
+
122
+ Replace `windows` with another supported Flet build target, such as `macos`, `apk`, `ipa`, or `web`. To run the example during Python development:
123
+
124
+ ```bash
125
+ flet run
126
+ ```
127
+
128
+ ## Development
129
+
130
+ The project follows Flet's extension structure:
131
+
132
+ ```text
133
+ src/flet_webview_all/ Python control
134
+ src/flutter/flet_webview_all/ Flutter extension and webview_all dependency
135
+ examples/flet_webview_all_example/ Sample Flet application
136
+ docs/ Additional documentation
137
+ ```
138
+
139
+ To add or update the Flutter dependency, work from the Flutter package directory:
140
+
141
+ ```bash
142
+ cd src/flutter/flet_webview_all
143
+ flutter pub get
144
+ ```
145
+
146
+ ## References
147
+
148
+ - [flet-webview-all repository](https://github.com/zaim-tech/flet-webview-all)
149
+ - [webview_all package](https://pub.dev/packages/webview_all)
150
+ - [Creating a Flet extension](https://flet.dev/docs/extend/user-extensions/)
151
+
152
+ ## License
153
+
154
+ See [LICENSE](LICENSE).
@@ -0,0 +1,141 @@
1
+ # flet-webview-all
2
+
3
+ `flet-webview-all` is a Flet extension that embeds web content in a Flet application. It wraps [`webview_all`](https://pub.dev/packages/webview_all), a Flutter WebView implementation with support for Android, iOS, Linux, macOS, Windows, and the web.
4
+
5
+ The control is a `ft.LayoutControl`, so it can use Flet layout properties such as `expand`, `width`, `height`, and `visible`.
6
+
7
+ ## Installation
8
+
9
+ Add this Git dependency to your application's `pyproject.toml`:
10
+
11
+ ```toml
12
+ [project]
13
+ dependencies = [
14
+ "flet>=0.86.5",
15
+ "flet-webview-all @ git+https://github.com/zaim-tech/flet-webview-all.git",
16
+ ]
17
+ ```
18
+
19
+ Then install the project dependencies with your preferred package manager, for example:
20
+
21
+ ```bash
22
+ pip install .
23
+ ```
24
+
25
+ For a local checkout during development, add the package as a path dependency instead. See the included [example application](examples/flet_webview_all_example/) for a working configuration.
26
+
27
+ ## Usage
28
+
29
+ ```python
30
+ import flet as ft
31
+
32
+ from flet_webview_all import FletWebviewAll
33
+
34
+
35
+ def main(page: ft.Page):
36
+ page.title = "WebView example"
37
+ page.add(
38
+ FletWebviewAll(
39
+ url="https://flet.dev",
40
+ expand=True,
41
+ )
42
+ )
43
+
44
+
45
+ ft.run(main)
46
+ ```
47
+
48
+ ### Render HTML directly
49
+
50
+ Pass a complete HTML document using `html`. The control loads `url` when it is set; otherwise, it uses `html`.
51
+
52
+ ```python
53
+ page.add(
54
+ FletWebviewAll(
55
+ html="""
56
+ <!doctype html>
57
+ <html>
58
+ <body><h1>Hello from Flet</h1></body>
59
+ </html>
60
+ """,
61
+ expand=True,
62
+ )
63
+ )
64
+ ```
65
+
66
+ ## Control properties
67
+
68
+ | Property | Type | Default | Description |
69
+ | --- | --- | --- | --- |
70
+ | `url` | `str \| None` | `None` | URL to load. When set, it takes precedence over `html`. |
71
+ | `html` | `str \| None` | `None` | Complete HTML document to render when `url` is not set. |
72
+ | `allow_navigation` | `bool` | `True` | Allows navigation requests from the WebView. |
73
+ | `zoom_enabled` | `bool` | `True` | Enables WebView zoom where the platform supports it. |
74
+ | `javascript_enabled` | `bool` | `True` | Enables unrestricted JavaScript execution. |
75
+ | `user_agent` | `str \| None` | `None` | Overrides the WebView user-agent when provided. |
76
+ | `debugging_enabled` | `bool` | `False` | Prints JavaScript console messages through Flutter's debug logger. |
77
+
78
+ Use `page.update()` after changing a control property at runtime:
79
+
80
+ ```python
81
+ webview.javascript_enabled = False
82
+ page.update()
83
+ ```
84
+
85
+ ## Platform support
86
+
87
+ Support is supplied by the underlying [`webview_all`](https://pub.dev/packages/webview_all) package:
88
+
89
+ | Platform | Minimum requirement / implementation |
90
+ | --- | --- |
91
+ | Android | API 24+ |
92
+ | iOS | 13.0+ (`WKWebView`) |
93
+ | Linux | `webkit2gtk-4.1` |
94
+ | macOS | 10.15+ (`WKWebView`) |
95
+ | Windows | Windows 10 version 1809+ (`WebView2`) |
96
+ | Web | Modern browser |
97
+
98
+ Platform WebView engines can differ in their capabilities. Test the settings your application relies on on each target platform.
99
+
100
+ ## Build the example
101
+
102
+ 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.
103
+
104
+ ```bash
105
+ cd examples/flet_webview_all_example
106
+ flet build windows -v
107
+ ```
108
+
109
+ Replace `windows` with another supported Flet build target, such as `macos`, `apk`, `ipa`, or `web`. To run the example during Python development:
110
+
111
+ ```bash
112
+ flet run
113
+ ```
114
+
115
+ ## Development
116
+
117
+ The project follows Flet's extension structure:
118
+
119
+ ```text
120
+ src/flet_webview_all/ Python control
121
+ src/flutter/flet_webview_all/ Flutter extension and webview_all dependency
122
+ examples/flet_webview_all_example/ Sample Flet application
123
+ docs/ Additional documentation
124
+ ```
125
+
126
+ To add or update the Flutter dependency, work from the Flutter package directory:
127
+
128
+ ```bash
129
+ cd src/flutter/flet_webview_all
130
+ flutter pub get
131
+ ```
132
+
133
+ ## References
134
+
135
+ - [flet-webview-all repository](https://github.com/zaim-tech/flet-webview-all)
136
+ - [webview_all package](https://pub.dev/packages/webview_all)
137
+ - [Creating a Flet extension](https://flet.dev/docs/extend/user-extensions/)
138
+
139
+ ## License
140
+
141
+ See [LICENSE](LICENSE).
@@ -0,0 +1,37 @@
1
+ [project]
2
+ name = "flet-webview-all"
3
+ version = "0.1.1"
4
+ description = "FletWebviewAll control for Flet"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10"
7
+ authors = [
8
+ { name = "Flet contributors", email = "you@example.com" }
9
+ ]
10
+ dependencies = [
11
+ "flet>=0.86.5",
12
+ ]
13
+
14
+ [dependency-groups]
15
+ dev = [
16
+ "mkdocs",
17
+ "mkdocs-material",
18
+ "mkdocstrings[python]"
19
+ ]
20
+
21
+ [project.urls]
22
+ Homepage = "https://mydomain.dev"
23
+ Documentation = "https://github.com/MyGithubAccount/flet-webview-all"
24
+ Repository = "https://github.com/MyGithubAccount/flet-webview-all"
25
+ Issues = "https://github.com/MyGithubAccount/flet-webview-all/issues"
26
+
27
+ [tool.setuptools.package-data]
28
+ "flutter.flet_webview_all" = ["**/*"]
29
+
30
+ [tool.setuptools]
31
+ license-files = []
32
+
33
+ [build-system]
34
+ requires = ["setuptools"]
35
+ build-backend = "setuptools.build_meta"
36
+
37
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ from flet_webview_all.flet_webview_all import FletWebviewAll
@@ -0,0 +1,30 @@
1
+ from typing import Optional
2
+
3
+ import flet as ft
4
+
5
+
6
+ @ft.control("flet_webview_all")
7
+ class FletWebviewAll(ft.LayoutControl):
8
+ """
9
+ FletWebviewAll Control - A unified webview control for displaying web content across all platforms.
10
+
11
+ This control integrates the webview_all Flutter package, providing a cross-platform webview
12
+ that works on Android, iOS, macOS, Windows, and Web platforms.
13
+
14
+ Properties:
15
+ url: The URL to load in the webview (http, https, file://, or data: URLs)
16
+ html: HTML content to display (alternative to url)
17
+ allow_navigation: Whether to allow navigation to new URLs (default: True)
18
+ zoom_enabled: Whether zoom controls are enabled (default: True)
19
+ javascript_enabled: Whether JavaScript is enabled (default: True)
20
+ user_agent: Custom User-Agent string
21
+ debugging_enabled: Whether debugging is enabled (default: False)
22
+ """
23
+
24
+ url: Optional[str] = None
25
+ html: Optional[str] = None
26
+ allow_navigation: bool = True
27
+ zoom_enabled: bool = True
28
+ javascript_enabled: bool = True
29
+ user_agent: Optional[str] = None
30
+ debugging_enabled: bool = False
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: flet-webview-all
3
+ Version: 0.1.1
4
+ Summary: FletWebviewAll control for Flet
5
+ Author-email: Flet contributors <you@example.com>
6
+ Project-URL: Homepage, https://mydomain.dev
7
+ Project-URL: Documentation, https://github.com/MyGithubAccount/flet-webview-all
8
+ Project-URL: Repository, https://github.com/MyGithubAccount/flet-webview-all
9
+ Project-URL: Issues, https://github.com/MyGithubAccount/flet-webview-all/issues
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: flet>=0.86.5
13
+
14
+ # flet-webview-all
15
+
16
+ `flet-webview-all` is a Flet extension that embeds web content in a Flet application. It wraps [`webview_all`](https://pub.dev/packages/webview_all), a Flutter WebView implementation with support for Android, iOS, Linux, macOS, Windows, and the web.
17
+
18
+ The control is a `ft.LayoutControl`, so it can use Flet layout properties such as `expand`, `width`, `height`, and `visible`.
19
+
20
+ ## Installation
21
+
22
+ Add this Git dependency to your application's `pyproject.toml`:
23
+
24
+ ```toml
25
+ [project]
26
+ dependencies = [
27
+ "flet>=0.86.5",
28
+ "flet-webview-all @ git+https://github.com/zaim-tech/flet-webview-all.git",
29
+ ]
30
+ ```
31
+
32
+ Then install the project dependencies with your preferred package manager, for example:
33
+
34
+ ```bash
35
+ pip install .
36
+ ```
37
+
38
+ For a local checkout during development, add the package as a path dependency instead. See the included [example application](examples/flet_webview_all_example/) for a working configuration.
39
+
40
+ ## Usage
41
+
42
+ ```python
43
+ import flet as ft
44
+
45
+ from flet_webview_all import FletWebviewAll
46
+
47
+
48
+ def main(page: ft.Page):
49
+ page.title = "WebView example"
50
+ page.add(
51
+ FletWebviewAll(
52
+ url="https://flet.dev",
53
+ expand=True,
54
+ )
55
+ )
56
+
57
+
58
+ ft.run(main)
59
+ ```
60
+
61
+ ### Render HTML directly
62
+
63
+ Pass a complete HTML document using `html`. The control loads `url` when it is set; otherwise, it uses `html`.
64
+
65
+ ```python
66
+ page.add(
67
+ FletWebviewAll(
68
+ html="""
69
+ <!doctype html>
70
+ <html>
71
+ <body><h1>Hello from Flet</h1></body>
72
+ </html>
73
+ """,
74
+ expand=True,
75
+ )
76
+ )
77
+ ```
78
+
79
+ ## Control properties
80
+
81
+ | Property | Type | Default | Description |
82
+ | --- | --- | --- | --- |
83
+ | `url` | `str \| None` | `None` | URL to load. When set, it takes precedence over `html`. |
84
+ | `html` | `str \| None` | `None` | Complete HTML document to render when `url` is not set. |
85
+ | `allow_navigation` | `bool` | `True` | Allows navigation requests from the WebView. |
86
+ | `zoom_enabled` | `bool` | `True` | Enables WebView zoom where the platform supports it. |
87
+ | `javascript_enabled` | `bool` | `True` | Enables unrestricted JavaScript execution. |
88
+ | `user_agent` | `str \| None` | `None` | Overrides the WebView user-agent when provided. |
89
+ | `debugging_enabled` | `bool` | `False` | Prints JavaScript console messages through Flutter's debug logger. |
90
+
91
+ Use `page.update()` after changing a control property at runtime:
92
+
93
+ ```python
94
+ webview.javascript_enabled = False
95
+ page.update()
96
+ ```
97
+
98
+ ## Platform support
99
+
100
+ Support is supplied by the underlying [`webview_all`](https://pub.dev/packages/webview_all) package:
101
+
102
+ | Platform | Minimum requirement / implementation |
103
+ | --- | --- |
104
+ | Android | API 24+ |
105
+ | iOS | 13.0+ (`WKWebView`) |
106
+ | Linux | `webkit2gtk-4.1` |
107
+ | macOS | 10.15+ (`WKWebView`) |
108
+ | Windows | Windows 10 version 1809+ (`WebView2`) |
109
+ | Web | Modern browser |
110
+
111
+ Platform WebView engines can differ in their capabilities. Test the settings your application relies on on each target platform.
112
+
113
+ ## Build the example
114
+
115
+ 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.
116
+
117
+ ```bash
118
+ cd examples/flet_webview_all_example
119
+ flet build windows -v
120
+ ```
121
+
122
+ Replace `windows` with another supported Flet build target, such as `macos`, `apk`, `ipa`, or `web`. To run the example during Python development:
123
+
124
+ ```bash
125
+ flet run
126
+ ```
127
+
128
+ ## Development
129
+
130
+ The project follows Flet's extension structure:
131
+
132
+ ```text
133
+ src/flet_webview_all/ Python control
134
+ src/flutter/flet_webview_all/ Flutter extension and webview_all dependency
135
+ examples/flet_webview_all_example/ Sample Flet application
136
+ docs/ Additional documentation
137
+ ```
138
+
139
+ To add or update the Flutter dependency, work from the Flutter package directory:
140
+
141
+ ```bash
142
+ cd src/flutter/flet_webview_all
143
+ flutter pub get
144
+ ```
145
+
146
+ ## References
147
+
148
+ - [flet-webview-all repository](https://github.com/zaim-tech/flet-webview-all)
149
+ - [webview_all package](https://pub.dev/packages/webview_all)
150
+ - [Creating a Flet extension](https://flet.dev/docs/extend/user-extensions/)
151
+
152
+ ## License
153
+
154
+ See [LICENSE](LICENSE).
@@ -0,0 +1,16 @@
1
+ README.md
2
+ pyproject.toml
3
+ src/flet_webview_all/__init__.py
4
+ src/flet_webview_all/flet_webview_all.py
5
+ src/flet_webview_all.egg-info/PKG-INFO
6
+ src/flet_webview_all.egg-info/SOURCES.txt
7
+ src/flet_webview_all.egg-info/dependency_links.txt
8
+ src/flet_webview_all.egg-info/requires.txt
9
+ src/flet_webview_all.egg-info/top_level.txt
10
+ src/flutter/flet_webview_all/pubspec.lock
11
+ src/flutter/flet_webview_all/pubspec.yaml
12
+ src/flutter/flet_webview_all/lib/flet_webview_all.dart
13
+ src/flutter/flet_webview_all/lib/src/extension.dart
14
+ src/flutter/flet_webview_all/lib/src/flet_webview_all.dart
15
+ src/flutter/flet_webview_all/lib/src/webview_impl.dart
16
+ src/flutter/flet_webview_all/lib/src/webview_stub.dart
@@ -0,0 +1,2 @@
1
+ flet_webview_all
2
+ flutter
@@ -0,0 +1,3 @@
1
+ library flet_webview_all;
2
+
3
+ export "src/extension.dart" show Extension;
@@ -0,0 +1,16 @@
1
+ import 'package:flet/flet.dart';
2
+ import 'package:flutter/widgets.dart';
3
+
4
+ import 'flet_webview_all.dart';
5
+
6
+ class Extension extends FletExtension {
7
+ @override
8
+ Widget? createWidget(Key? key, Control control) {
9
+ switch (control.type) {
10
+ case "flet_webview_all":
11
+ return FletWebviewAllControl(control: control);
12
+ default:
13
+ return null;
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,38 @@
1
+ import 'package:flet/flet.dart';
2
+ import 'package:flutter/material.dart';
3
+ import 'webview_impl.dart';
4
+
5
+ class FletWebviewAllControl extends StatelessWidget {
6
+ final Control control;
7
+
8
+ const FletWebviewAllControl({
9
+ super.key,
10
+ required this.control,
11
+ });
12
+
13
+ @override
14
+ Widget build(BuildContext context) {
15
+ String? url = control.getString("url");
16
+ String? html = control.getString("html");
17
+ bool allowNavigation = control.getBool("allow_navigation", true) ?? true;
18
+ bool zoomEnabled = control.getBool("zoom_enabled", true) ?? true;
19
+ bool javascriptEnabled = control.getBool("javascript_enabled", true) ?? true;
20
+ bool debuggingEnabled = control.getBool("debugging_enabled", false) ?? false;
21
+ String? userAgent = control.getString("user_agent");
22
+
23
+ // Determine initial content - use url if available, otherwise html
24
+ String initialContent = url ?? html ?? "about:blank";
25
+
26
+ // Use the platform-specific implementation imported above
27
+ Widget myControl = buildWebviewWidget(
28
+ initialContent: initialContent,
29
+ javascriptEnabled: javascriptEnabled,
30
+ allowNavigation: allowNavigation,
31
+ debuggingEnabled: debuggingEnabled,
32
+ userAgent: userAgent,
33
+ zoomEnabled: zoomEnabled,
34
+ );
35
+
36
+ return LayoutControl(control: control, child: myControl);
37
+ }
38
+ }