flet-webview 0.2.0.dev44__py3-none-any.whl → 0.2.0.dev57__py3-none-any.whl
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.
Potentially problematic release.
This version of flet-webview might be problematic. Click here for more details.
- flet_webview/__init__.py +9 -0
- flet_webview/types.py +17 -7
- flet_webview/webview.py +60 -48
- {flet_webview-0.2.0.dev44.dist-info → flet_webview-0.2.0.dev57.dist-info}/METADATA +2 -2
- {flet_webview-0.2.0.dev44.dist-info → flet_webview-0.2.0.dev57.dist-info}/RECORD +10 -10
- flutter/flet_webview/pubspec.lock +12 -12
- flutter/flet_webview/pubspec.yaml +2 -2
- {flet_webview-0.2.0.dev44.dist-info → flet_webview-0.2.0.dev57.dist-info}/WHEEL +0 -0
- {flet_webview-0.2.0.dev44.dist-info → flet_webview-0.2.0.dev57.dist-info}/licenses/LICENSE +0 -0
- {flet_webview-0.2.0.dev44.dist-info → flet_webview-0.2.0.dev57.dist-info}/top_level.txt +0 -0
flet_webview/__init__.py
CHANGED
flet_webview/types.py
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
from dataclasses import dataclass
|
|
2
2
|
from enum import Enum
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
3
4
|
|
|
4
5
|
import flet as ft
|
|
5
6
|
|
|
7
|
+
if TYPE_CHECKING:
|
|
8
|
+
from .webview import WebView # noqa
|
|
9
|
+
|
|
6
10
|
__all__ = [
|
|
7
|
-
"RequestMethod",
|
|
8
11
|
"LogLevelSeverity",
|
|
9
|
-
"
|
|
12
|
+
"RequestMethod",
|
|
10
13
|
"WebViewConsoleMessageEvent",
|
|
11
14
|
"WebViewJavaScriptEvent",
|
|
15
|
+
"WebViewScrollEvent",
|
|
12
16
|
]
|
|
13
17
|
|
|
14
18
|
|
|
@@ -45,16 +49,22 @@ class LogLevelSeverity(Enum):
|
|
|
45
49
|
|
|
46
50
|
|
|
47
51
|
@dataclass
|
|
48
|
-
class WebViewScrollEvent(ft.Event[
|
|
52
|
+
class WebViewScrollEvent(ft.Event["WebView"]):
|
|
49
53
|
x: float
|
|
50
|
-
"""
|
|
54
|
+
"""
|
|
55
|
+
The value of the horizontal offset with the origin being at the
|
|
56
|
+
leftmost of the `WebView`.
|
|
57
|
+
"""
|
|
51
58
|
|
|
52
59
|
y: float
|
|
53
|
-
"""
|
|
60
|
+
"""
|
|
61
|
+
The value of the vertical offset with the origin being at the
|
|
62
|
+
topmost of the `WebView`.
|
|
63
|
+
"""
|
|
54
64
|
|
|
55
65
|
|
|
56
66
|
@dataclass
|
|
57
|
-
class WebViewConsoleMessageEvent(ft.Event[
|
|
67
|
+
class WebViewConsoleMessageEvent(ft.Event["WebView"]):
|
|
58
68
|
message: str
|
|
59
69
|
"""The message written to the console."""
|
|
60
70
|
|
|
@@ -63,7 +73,7 @@ class WebViewConsoleMessageEvent(ft.Event[ft.EventControlType]):
|
|
|
63
73
|
|
|
64
74
|
|
|
65
75
|
@dataclass
|
|
66
|
-
class WebViewJavaScriptEvent(ft.Event[
|
|
76
|
+
class WebViewJavaScriptEvent(ft.Event["WebView"]):
|
|
67
77
|
message: str
|
|
68
78
|
"""The message to be displayed in the window."""
|
|
69
79
|
|
flet_webview/webview.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
from typing import
|
|
2
|
+
from typing import Optional
|
|
3
3
|
|
|
4
4
|
import flet as ft
|
|
5
5
|
|
|
@@ -27,103 +27,101 @@ class WebView(ft.ConstrainedControl):
|
|
|
27
27
|
|
|
28
28
|
enable_javascript: Optional[bool] = None
|
|
29
29
|
"""
|
|
30
|
-
Enable or disable the JavaScript execution on the page.
|
|
31
|
-
|
|
32
|
-
Note that disabling the JavaScript execution on the page may result to
|
|
30
|
+
Enable or disable the JavaScript execution on the page.
|
|
31
|
+
|
|
32
|
+
Note that disabling the JavaScript execution on the page may result to
|
|
33
|
+
unexpected web page behaviour.
|
|
33
34
|
"""
|
|
34
35
|
|
|
35
|
-
prevent_links: Optional[
|
|
36
|
+
prevent_links: Optional[list[str]] = None
|
|
36
37
|
"""List of url-prefixes that should not be followed/loaded/downloaded."""
|
|
37
38
|
|
|
38
39
|
bgcolor: Optional[ft.ColorValue] = None
|
|
39
40
|
"""Defines the background color of the WebView."""
|
|
40
41
|
|
|
41
|
-
on_page_started: ft.
|
|
42
|
+
on_page_started: Optional[ft.ControlEventHandler["WebView"]] = None
|
|
42
43
|
"""
|
|
43
44
|
Fires soon as the first loading process of the webview page is started.
|
|
44
|
-
|
|
45
|
-
Event handler argument's `data` property is of type
|
|
46
|
-
|
|
45
|
+
|
|
46
|
+
Event handler argument's [`data`][flet.Event.data] property is of type
|
|
47
|
+
`str` and contains the URL.
|
|
48
|
+
|
|
47
49
|
Note:
|
|
48
50
|
Works only on the following platforms: iOS, Android and macOS.
|
|
49
51
|
"""
|
|
50
52
|
|
|
51
|
-
on_page_ended: ft.
|
|
53
|
+
on_page_ended: Optional[ft.ControlEventHandler["WebView"]] = None
|
|
52
54
|
"""
|
|
53
55
|
Fires when all the webview page loading processes are ended.
|
|
54
|
-
|
|
55
|
-
Event handler argument's `data` property is of type `str`
|
|
56
|
-
|
|
56
|
+
|
|
57
|
+
Event handler argument's [`data`][flet.Event.data] property is of type `str`
|
|
58
|
+
and contains the URL.
|
|
59
|
+
|
|
57
60
|
Note:
|
|
58
61
|
Works only on the following platforms: iOS, Android and macOS.
|
|
59
62
|
"""
|
|
60
63
|
|
|
61
|
-
on_web_resource_error: ft.
|
|
64
|
+
on_web_resource_error: Optional[ft.ControlEventHandler["WebView"]] = None
|
|
62
65
|
"""
|
|
63
66
|
Fires when there is error with loading a webview page resource.
|
|
64
|
-
|
|
65
|
-
Event handler argument's `data` property is of type
|
|
66
|
-
|
|
67
|
+
|
|
68
|
+
Event handler argument's [`data`][flet.Event.data] property is of type
|
|
69
|
+
`str` and contains the error message.
|
|
70
|
+
|
|
67
71
|
Note:
|
|
68
72
|
Works only on the following platforms: iOS, Android and macOS.
|
|
69
73
|
"""
|
|
70
74
|
|
|
71
|
-
on_progress: ft.
|
|
75
|
+
on_progress: Optional[ft.ControlEventHandler["WebView"]] = None
|
|
72
76
|
"""
|
|
73
77
|
Fires when the progress of the webview page loading is changed.
|
|
74
|
-
|
|
75
|
-
Event handler argument's `data` property is of type
|
|
76
|
-
|
|
78
|
+
|
|
79
|
+
Event handler argument's [`data`][flet.Event.data] property is of type
|
|
80
|
+
`int` and contains the progress value.
|
|
81
|
+
|
|
77
82
|
Note:
|
|
78
83
|
Works only on the following platforms: iOS, Android and macOS.
|
|
79
84
|
"""
|
|
80
85
|
|
|
81
|
-
on_url_change: ft.
|
|
86
|
+
on_url_change: Optional[ft.ControlEventHandler["WebView"]] = None
|
|
82
87
|
"""
|
|
83
88
|
Fires when the URL of the webview page is changed.
|
|
84
|
-
|
|
85
|
-
Event handler argument's `data` property is of type
|
|
86
|
-
|
|
89
|
+
|
|
90
|
+
Event handler argument's [`data`][flet.Event.data] property is of type
|
|
91
|
+
`str` and contains the new URL.
|
|
92
|
+
|
|
87
93
|
Note:
|
|
88
94
|
Works only on the following platforms: iOS, Android and macOS.
|
|
89
95
|
"""
|
|
90
96
|
|
|
91
|
-
on_scroll: ft.
|
|
97
|
+
on_scroll: Optional[ft.EventHandler[WebViewScrollEvent]] = None
|
|
92
98
|
"""
|
|
93
99
|
Fires when the web page's scroll position changes.
|
|
94
|
-
|
|
95
|
-
Event handler argument is of type `WebviewScrollEvent`.
|
|
96
|
-
|
|
100
|
+
|
|
97
101
|
Note:
|
|
98
102
|
Works only on the following platforms: iOS, Android and macOS.
|
|
99
103
|
"""
|
|
100
104
|
|
|
101
|
-
on_console_message: ft.
|
|
102
|
-
WebViewConsoleMessageEvent["WebView"]
|
|
103
|
-
] = None
|
|
105
|
+
on_console_message: Optional[ft.EventHandler[WebViewConsoleMessageEvent]] = None
|
|
104
106
|
"""
|
|
105
107
|
Fires when a log message is written to the JavaScript console.
|
|
106
|
-
|
|
107
|
-
Event handler argument is of type `WebviewConsoleMessageEvent`.
|
|
108
|
-
|
|
108
|
+
|
|
109
109
|
Note:
|
|
110
110
|
Works only on the following platforms: iOS, Android and macOS.
|
|
111
111
|
"""
|
|
112
112
|
|
|
113
|
-
on_javascript_alert_dialog: ft.
|
|
114
|
-
WebViewJavaScriptEvent["WebView"]
|
|
115
|
-
] = None
|
|
113
|
+
on_javascript_alert_dialog: Optional[ft.EventHandler[WebViewJavaScriptEvent]] = None
|
|
116
114
|
"""
|
|
117
115
|
Fires when the web page attempts to display a JavaScript alert() dialog.
|
|
118
|
-
|
|
119
|
-
Event handler argument is of type `WebviewJavaScriptEvent`.
|
|
120
|
-
|
|
116
|
+
|
|
121
117
|
Note:
|
|
122
118
|
Works only on the following platforms: iOS, Android and macOS.
|
|
123
119
|
"""
|
|
124
120
|
|
|
125
121
|
def _check_mobile_or_mac_platform(self):
|
|
126
|
-
"""
|
|
122
|
+
"""
|
|
123
|
+
Checks/Validates support for the current platform (iOS, Android, or macOS).
|
|
124
|
+
"""
|
|
127
125
|
assert self.page is not None, "WebView must be added to page first."
|
|
128
126
|
if self.page.web or self.page.platform not in [
|
|
129
127
|
ft.PagePlatform.ANDROID,
|
|
@@ -312,10 +310,12 @@ class WebView(ft.ConstrainedControl):
|
|
|
312
310
|
|
|
313
311
|
async def get_current_url_async(self) -> Optional[str]:
|
|
314
312
|
"""
|
|
315
|
-
Returns the current URL that the WebView is displaying or `None`
|
|
313
|
+
Returns the current URL that the WebView is displaying or `None`
|
|
314
|
+
if no URL was ever loaded.
|
|
316
315
|
|
|
317
316
|
Returns:
|
|
318
|
-
The current URL that the WebView is displaying or `None`
|
|
317
|
+
The current URL that the WebView is displaying or `None`
|
|
318
|
+
if no URL was ever loaded.
|
|
319
319
|
|
|
320
320
|
Note:
|
|
321
321
|
Works only on the following platforms: iOS, Android and macOS.
|
|
@@ -373,7 +373,10 @@ class WebView(ft.ConstrainedControl):
|
|
|
373
373
|
Works only on the following platforms: iOS, Android and macOS.
|
|
374
374
|
"""
|
|
375
375
|
self._check_mobile_or_mac_platform()
|
|
376
|
-
await self._invoke_method_async(
|
|
376
|
+
await self._invoke_method_async(
|
|
377
|
+
method_name="load_file",
|
|
378
|
+
arguments={"path": path},
|
|
379
|
+
)
|
|
377
380
|
|
|
378
381
|
def load_request(self, url: str, method: RequestMethod = RequestMethod.GET):
|
|
379
382
|
"""
|
|
@@ -428,7 +431,10 @@ class WebView(ft.ConstrainedControl):
|
|
|
428
431
|
Works only on the following platforms: iOS, Android and macOS.
|
|
429
432
|
"""
|
|
430
433
|
self._check_mobile_or_mac_platform()
|
|
431
|
-
await self._invoke_method_async(
|
|
434
|
+
await self._invoke_method_async(
|
|
435
|
+
method_name="run_javascript",
|
|
436
|
+
arguments={"value": value},
|
|
437
|
+
)
|
|
432
438
|
|
|
433
439
|
def load_html(self, value: str, base_url: Optional[str] = None):
|
|
434
440
|
"""
|
|
@@ -486,7 +492,10 @@ class WebView(ft.ConstrainedControl):
|
|
|
486
492
|
Works only on the following platforms: iOS, Android and macOS.
|
|
487
493
|
"""
|
|
488
494
|
self._check_mobile_or_mac_platform()
|
|
489
|
-
await self._invoke_method_async(
|
|
495
|
+
await self._invoke_method_async(
|
|
496
|
+
method_name="scroll_to",
|
|
497
|
+
arguments={"x": x, "y": y},
|
|
498
|
+
)
|
|
490
499
|
|
|
491
500
|
def scroll_by(self, x: int, y: int):
|
|
492
501
|
"""
|
|
@@ -514,4 +523,7 @@ class WebView(ft.ConstrainedControl):
|
|
|
514
523
|
Works only on the following platforms: iOS, Android and macOS.
|
|
515
524
|
"""
|
|
516
525
|
self._check_mobile_or_mac_platform()
|
|
517
|
-
await self._invoke_method_async(
|
|
526
|
+
await self._invoke_method_async(
|
|
527
|
+
method_name="scroll_by",
|
|
528
|
+
arguments={"x": x, "y": y},
|
|
529
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flet-webview
|
|
3
|
-
Version: 0.2.0.
|
|
3
|
+
Version: 0.2.0.dev57
|
|
4
4
|
Summary: Display web content in Flet apps using WebView.
|
|
5
5
|
Author-email: Flet contributors <hello@flet.dev>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -11,7 +11,7 @@ Project-URL: Issues, https://github.com/flet-dev/flet-webview/issues
|
|
|
11
11
|
Requires-Python: >=3.10
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
|
-
Requires-Dist: flet>=0.70.0
|
|
14
|
+
Requires-Dist: flet>=0.70.0.dev0
|
|
15
15
|
Dynamic: license-file
|
|
16
16
|
|
|
17
17
|
# flet-webview
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
flet_webview/__init__.py,sha256=
|
|
2
|
-
flet_webview/types.py,sha256=
|
|
3
|
-
flet_webview/webview.py,sha256=
|
|
4
|
-
flet_webview-0.2.0.
|
|
1
|
+
flet_webview/__init__.py,sha256=SWDWQdhlKm3cxXDaNJYAhnM-ID3XGntVCmz3ADdY7vE,342
|
|
2
|
+
flet_webview/types.py,sha256=J5LLp3OIk6jNac-bsK26vndLTbtcVbOL4LNbw3XncCg,1898
|
|
3
|
+
flet_webview/webview.py,sha256=3SCsZzNNcNWN4um7ZxIYilhqknI5CnedS_GhcuGKKWQ,16474
|
|
4
|
+
flet_webview-0.2.0.dev57.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
5
|
flutter/flet_webview/CHANGELOG.md,sha256=66sWepPaeTc9_lzcYIGU55AlxSU5Z1XVtknXpzd_-p8,40
|
|
6
6
|
flutter/flet_webview/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
7
7
|
flutter/flet_webview/README.md,sha256=GIdqSwI5CZ6a1JQad87qfn_zGBRL2hPB6nTgB2PtuaU,64
|
|
8
8
|
flutter/flet_webview/analysis_options.yaml,sha256=32kjGAc-zF87inWaH5M46yGZWQDTwrwfvNLHeAocfG4,154
|
|
9
|
-
flutter/flet_webview/pubspec.lock,sha256=
|
|
10
|
-
flutter/flet_webview/pubspec.yaml,sha256=
|
|
9
|
+
flutter/flet_webview/pubspec.lock,sha256=SetDCgqeitIL9qWutoohuD95qYQq_KCn-aL9iq88yqU,24125
|
|
10
|
+
flutter/flet_webview/pubspec.yaml,sha256=5atkJMd8GycvAiSzZJIC7YKGMF9BXnwIiGmjKxMHLZM,641
|
|
11
11
|
flutter/flet_webview/lib/flet_webview.dart,sha256=aB3uPJrudP8SaZfpr2GH3c3j2jEZcEIeGrAkFiXb9IA,67
|
|
12
12
|
flutter/flet_webview/lib/src/extension.dart,sha256=lff3mOfxO2_Ite2Oi5VAoHD42BGrN3N4hjF0rGuPv3s,350
|
|
13
13
|
flutter/flet_webview/lib/src/webview.dart,sha256=HrcXyQv_rVuun0szbEUEFloKSARLy54c78L9gpK6RIA,975
|
|
@@ -17,7 +17,7 @@ flutter/flet_webview/lib/src/webview_web_vain.dart,sha256=Asu8QRq7Fky8MDEdKcOa01
|
|
|
17
17
|
flutter/flet_webview/lib/src/webview_windows_and_linux.dart,sha256=LxkO6qbz0aaZM9UYSufUCjrNr1pK12pwlqutH4_-aio,314
|
|
18
18
|
flutter/flet_webview/lib/src/webview_windows_and_linux_vain.dart,sha256=pF5i1Tqy6avqSiwpqAoIEr98Z7y3ZE_HOrAThhIF86A,452
|
|
19
19
|
flutter/flet_webview/lib/src/utils/webview.dart,sha256=s-1UY7kFIzeMRBO_a_XQA1B8YIRxPDIBAmB5Fnw6Fe4,380
|
|
20
|
-
flet_webview-0.2.0.
|
|
21
|
-
flet_webview-0.2.0.
|
|
22
|
-
flet_webview-0.2.0.
|
|
23
|
-
flet_webview-0.2.0.
|
|
20
|
+
flet_webview-0.2.0.dev57.dist-info/METADATA,sha256=BT-2aVHAhLqf7t4viqtqOfvg2oF7kgkigj9rhcZkXX0,2043
|
|
21
|
+
flet_webview-0.2.0.dev57.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
22
|
+
flet_webview-0.2.0.dev57.dist-info/top_level.txt,sha256=svOnOxqAYWBe87-fr3VmmQm8S73eVhAu0t9O3MryqS4,21
|
|
23
|
+
flet_webview-0.2.0.dev57.dist-info/RECORD,,
|
|
@@ -125,8 +125,8 @@ packages:
|
|
|
125
125
|
dependency: "direct main"
|
|
126
126
|
description:
|
|
127
127
|
path: "packages/flet"
|
|
128
|
-
ref:
|
|
129
|
-
resolved-ref:
|
|
128
|
+
ref: main
|
|
129
|
+
resolved-ref: cf8823c5d766ea7866480986aa3ee871f4091e78
|
|
130
130
|
url: "https://github.com/flet-dev/flet.git"
|
|
131
131
|
source: git
|
|
132
132
|
version: "0.70.0"
|
|
@@ -147,10 +147,10 @@ packages:
|
|
|
147
147
|
dependency: "direct dev"
|
|
148
148
|
description:
|
|
149
149
|
name: flutter_lints
|
|
150
|
-
sha256:
|
|
150
|
+
sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1"
|
|
151
151
|
url: "https://pub.dev"
|
|
152
152
|
source: hosted
|
|
153
|
-
version: "
|
|
153
|
+
version: "3.0.2"
|
|
154
154
|
flutter_localizations:
|
|
155
155
|
dependency: transitive
|
|
156
156
|
description: flutter
|
|
@@ -258,10 +258,10 @@ packages:
|
|
|
258
258
|
dependency: transitive
|
|
259
259
|
description:
|
|
260
260
|
name: lints
|
|
261
|
-
sha256:
|
|
261
|
+
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
|
|
262
262
|
url: "https://pub.dev"
|
|
263
263
|
source: hosted
|
|
264
|
-
version: "
|
|
264
|
+
version: "3.0.0"
|
|
265
265
|
logging:
|
|
266
266
|
dependency: transitive
|
|
267
267
|
description:
|
|
@@ -727,10 +727,10 @@ packages:
|
|
|
727
727
|
dependency: transitive
|
|
728
728
|
description:
|
|
729
729
|
name: webview_flutter_android
|
|
730
|
-
sha256:
|
|
730
|
+
sha256: "9573ad97890d199ac3ab32399aa33a5412163b37feb573eb5b0a76b35e9ffe41"
|
|
731
731
|
url: "https://pub.dev"
|
|
732
732
|
source: hosted
|
|
733
|
-
version: "4.
|
|
733
|
+
version: "4.8.2"
|
|
734
734
|
webview_flutter_platform_interface:
|
|
735
735
|
dependency: "direct main"
|
|
736
736
|
description:
|
|
@@ -751,10 +751,10 @@ packages:
|
|
|
751
751
|
dependency: transitive
|
|
752
752
|
description:
|
|
753
753
|
name: webview_flutter_wkwebview
|
|
754
|
-
sha256:
|
|
754
|
+
sha256: "71523b9048cf510cfa1fd4e0a3fa5e476a66e0884d5df51d59d5023dba237107"
|
|
755
755
|
url: "https://pub.dev"
|
|
756
756
|
source: hosted
|
|
757
|
-
version: "3.22.
|
|
757
|
+
version: "3.22.1"
|
|
758
758
|
win32:
|
|
759
759
|
dependency: transitive
|
|
760
760
|
description:
|
|
@@ -775,10 +775,10 @@ packages:
|
|
|
775
775
|
dependency: transitive
|
|
776
776
|
description:
|
|
777
777
|
name: window_manager
|
|
778
|
-
sha256: "
|
|
778
|
+
sha256: "7eb6d6c4164ec08e1bf978d6e733f3cebe792e2a23fb07cbca25c2872bfdbdcd"
|
|
779
779
|
url: "https://pub.dev"
|
|
780
780
|
source: hosted
|
|
781
|
-
version: "0.5.
|
|
781
|
+
version: "0.5.1"
|
|
782
782
|
window_to_front:
|
|
783
783
|
dependency: transitive
|
|
784
784
|
description:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|