You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am developing a Windows application. Due to text rendering issues (not-clear text issues) on Windows with skia, I am implementing my chat room area by embedding InAppWebView. So my purpose of putting InAppWebView into my widget tree is to work around the text rendering problems.
How WebView is Used
The area wrapped by the Container with the red border in the image below is the InAppWebView widget.
Actual Behavior (Problem)
If I press the Alt + F4 shortcut key while the WebView area is focused, the WebView terminates. When the WebView is terminated in this way, no event is triggered. I cannot detect that the WebView has been terminated.
Expected Behavior
Both of the followings. Or either one.
If I press the Alt + F4, the entire app should be terminated, not only the WebView.
It should be possible to detect when the WebView is terminated.
Steps with code example to reproduce
Windows environment desktop app
Mouse click on the WebView area to focus the WebView area
Press ALT + F4
Flutter version
v3.27.4
Operating System, Device-specific and/or Tool
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.27.4, on Microsoft Windows [Version 10.0.19045.3803])
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.13.0)
[√] Android Studio (version 2023.1)
[√] VS Code (version 1.97.1)
[√] Connected device (3 available)
[√] Network resources
Plugin version
v6.1.5
Troubleshooting Attempts
(JavaScript) onbeforeunload
This failed because the termination occurs first at the OS level before the JavaScript event can be triggered.
(InAppWebView) onCloseWindow
This does not work because the WebView is terminated before the WindowCloseRequest event is detected.
(Flutter) Wrapping InAppWebView with KeyboardListener
While the WebView is focused, no event that KeyboardListener can detect is triggered even if a key is pressed.
(Flutter) Prevent Being Focused with IgnorePointer
My chat system needs a clickable message(e.g. download). So there are restrictions to use it.
This library can detect the close event. However, it cannot be embedded within the screen as a Flutter widget. It operates in a separate window. I believe it can detect the close event because it operates in a separate window.
The key of this library's close event listener seems to be implementing MessageHandler in desktop_webview_window/windows/webview_window.cc. I believe the implementation above could be a big hint to solving the issue at hand.
Since it appears in a separate window, it cannot be used as an alternative to InAppWebView.
This library does not implement texture. So always the WebView floating. Perhaps because of this, there is no special reaction in the WebView even if Alt + F4 is pressed. Naturally, the entire Flutter app is terminated after Alt + F4 is pressed.
However, due to an absence of texture, there are too many restrictions to use it.
the others
the other libraries are in the same situation as flutter_inappwebview (either they cannot detect a close event with their own event listener such as onCloseWindow of InAppWebView or they don't have any event listeners related with termination).
The text was updated successfully, but these errors were encountered:
Background
I am developing a Windows application. Due to text rendering issues (not-clear text issues) on Windows with skia, I am implementing my chat room area by embedding InAppWebView. So my purpose of putting InAppWebView into my widget tree is to work around the text rendering problems.
How WebView is Used
The area wrapped by the Container with the red border in the image below is the InAppWebView widget.
Actual Behavior (Problem)
If I press the Alt + F4 shortcut key while the WebView area is focused, the WebView terminates. When the WebView is terminated in this way, no event is triggered. I cannot detect that the WebView has been terminated.
Expected Behavior
Both of the followings. Or either one.
Steps with code example to reproduce
Flutter version
v3.27.4
Operating System, Device-specific and/or Tool
flutter doctor
Plugin version
v6.1.5
Troubleshooting Attempts
(JavaScript)
onbeforeunload
This failed because the termination occurs first at the OS level before the JavaScript event can be triggered.
(InAppWebView)
onCloseWindow
This does not work because the WebView is terminated before the
WindowCloseRequest
event is detected.(Flutter) Wrapping InAppWebView with
KeyboardListener
While the WebView is focused, no event that
KeyboardListener
can detect is triggered even if a key is pressed.(Flutter) Prevent Being Focused with
IgnorePointer
My chat system needs a clickable message(e.g. download). So there are restrictions to use it.
Reasearch on Other Libraries
desktop_webview_window
This library can detect the close event. However, it cannot be embedded within the screen as a Flutter widget. It operates in a separate window. I believe it can detect the close event because it operates in a separate window.
The key of this library's close event listener seems to be implementing
MessageHandler
indesktop_webview_window/windows/webview_window.cc
. I believe the implementation above could be a big hint to solving the issue at hand.Since it appears in a separate window, it cannot be used as an alternative to
InAppWebView
.webview_win_floating
This library does not implement texture. So always the WebView floating. Perhaps because of this, there is no special reaction in the WebView even if Alt + F4 is pressed. Naturally, the entire Flutter app is terminated after Alt + F4 is pressed.
However, due to an absence of texture, there are too many restrictions to use it.
the others
the other libraries are in the same situation as
flutter_inappwebview
(either they cannot detect a close event with their own event listener such asonCloseWindow
ofInAppWebView
or they don't have any event listeners related with termination).The text was updated successfully, but these errors were encountered: