flet
flet copied to clipboard
feat: `WebView` enhancements
Summary by Sourcery
Enhance the WebView component with new event handling and method support, refactor platform detection logic, and update dependencies for improved platform-specific functionality.
New Features:
- Introduce new event handling capabilities for the WebView component, including scroll, console message, and JavaScript alert dialog events.
- Add support for various WebView methods such as reload, go back, go forward, enable/disable zoom, clear cache, and run JavaScript.
- Implement platform-specific WebView support for mobile, macOS, web, Windows, and Linux platforms.
Enhancements:
- Deprecate the 'javascript_enabled' property in favor of 'enable_javascript' in the WebView component.
- Refactor platform detection logic by introducing a new 'platform.dart' utility for better platform-specific checks.
Build:
- Update dependencies in the pubspec.yaml file, including upgrading 'webview_flutter' and adding new dependencies like 'webview_flutter_web' and 'webview_flutter_platform_interface'.
Reviewer's Guide by Sourcery
This pull request introduces significant enhancements to the WebView component in the Flet framework, improving its functionality across different platforms (mobile, web, and desktop). The changes include new features, better platform support, and code refactoring for improved maintainability.
File-Level Changes
| Change | Details | Files |
|---|---|---|
| Enhanced WebView functionality with new methods and events |
|
sdk/python/packages/flet-core/src/flet_core/webview.py |
| Improved cross-platform support for WebView |
|
packages/flet_webview/lib/src/webview_mobile_and_mac.dartpackages/flet_webview/lib/src/webview_web.dartpackages/flet_webview/lib/src/webview_windows_and_linux.dartpackages/flet/lib/src/utils/platform.dart |
| Refactored existing code for better maintainability |
|
packages/flet/lib/src/utils/desktop.dartpackages/flet/lib/src/controls/webview.dartpackages/flet/lib/src/controls/page.dartpackages/flet/lib/src/controls/grid_view.dartpackages/flet/lib/src/controls/list_view.dartpackages/flet/lib/src/controls/scrollable_control.dart |
| Updated dependencies and configurations |
|
packages/flet_webview/pubspec.yamlclient/ios/Runner/AppDelegate.swiftclient/macos/Flutter/GeneratedPluginRegistrant.swift |
Tips
- Trigger a new Sourcery review by commenting
@sourcery-ai reviewon the pull request. - Continue your discussion with Sourcery by replying directly to review comments.
- You can change your review settings at any time by accessing your dashboard:
- Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
- Change the review language;
- You can always contact us if you have any questions or feedback.
Kindly merge and one more thing add permission in manifest for Android to display local html files in web view
Summary by Sourcery
Enhance the WebView component with new event handling and method support, refactor platform detection logic, and update dependencies for improved platform-specific functionality.
New Features:
- Introduce new event handling capabilities for the WebView component, including scroll, console message, and JavaScript alert dialog events.
- Add support for various WebView methods such as reload, go back, go forward, enable/disable zoom, clear cache, and run JavaScript.
- Implement platform-specific WebView support for mobile, macOS, web, Windows, and Linux platforms.
Enhancements:
- Deprecate the 'javascript_enabled' property in favor of 'enable_javascript' in the WebView component.
- Refactor platform detection logic by introducing a new 'platform.dart' utility for better platform-specific checks.
Build:
- Update dependencies in the pubspec.yaml file, including upgrading 'webview_flutter' and adding new dependencies like 'webview_flutter_web' and 'webview_flutter_platform_interface'.
Any update???
Any update?
Is there any chance for supporting WebView CookieManager ?
This looks great! Can't wait to implement this in my project once it gets merged to main!!
@sourcery-ai review
Is it merged and working on desktop??
Have documentation updated in flet docs?
Working on it.
Good stuff @ndonkoHenri 😎! But i have some questions, are we going to get the run_javascripts() methods support on other platforms soon? I thought this PR would add WV support for the windows,
Windows and Linux are not yet supported. Will have a look at them after we release 0.25.0.
Would be great to have the run_javascripts() method on Web too
Edit: Am not able to update the url value when running on web. Is it a bug or that’s how it’s supposed to be?
Am able to change the url value outside of a function,… but once am inside a function/eventhandler an error is shown saying that the method is supported on Android, iOS and macOS only.
@Benitmulindwa let's continue this in a new discussion. Can you create one and explain the issues you face?
@ndonkoHenri all right lemme do it
#4356
On Windows, an error is reported: Webview is not yet supported on this Platform.
Windows and Linux support is still to be added.
@ndonkoHenri Hello, I attempted to run WebView on the Android platform, but found that it couldn't execute JavaScript. This issue doesn't exist on the web platform. Could you please tell me what might be the reason for this? flet==0.27.6 flet-webview==0.1.0 python==3.12 Android version 12
Kindly implemented refresh or reload method in flet also for reloading current screen