Is there an existing issue for this?
Current Behavior
On Windows, setting
initialSettings: InAppWebViewSettings(
transparentBackground: true,
)
does not take effect — the background remains white.
Expected Behavior
transparentbackground
Steps with code example to reproduce
Set
initialSettings: InAppWebViewSettings(
transparentBackground: true,
)
Run on Windows
Observe that the background is not transparent
Stacktrace/Logs
no logs
Flutter version
v3.32.6
Operating System, Device-specific and/or Tool
windows
Plugin version
v6.1.4
Additional information
🔍 Issue Analysis
1️⃣ File
windows/flutter/ephemeral/.plugin_symlinks/flutter_inappwebview_windows/windows/in_app_webview/in_app_webview.cpp
Lines 208–213:
wil::com_ptr<ICoreWebView2Controller2> webViewController2;
if (succeededOrLog(webViewController->QueryInterface(IID_PPV_ARGS(&webViewController2)))) {
if (!settings->transparentBackground) {
webViewController2->put_DefaultBackgroundColor({ 0, 255, 255, 255 });
}
}
The logic for transparentBackground is inverted here.
It should apply a transparent background when transparentBackground == true, not the opposite.
2️⃣ Same file, lines 1441–1445:
wil::com_ptr<ICoreWebView2Controller2> webViewController2;
if (succeededOrLog(webViewController->QueryInterface(IID_PPV_ARGS(&webViewController2)))) {
if (fl_map_contains_not_null(newSettingsMap, "transparentBackground") && settings->transparentBackground != newSettings->transparentBackground) {
BYTE alpha = newSettings->transparentBackground ? 0 : 255;
webViewController2->put_DefaultBackgroundColor({ alpha, 255, 255, 255 });
}
}
Here, newSettings->transparentBackground is always false,
so alpha never becomes 0.
When I forced alpha = 0, the transparent background worked correctly.
Notes
I’m not very familiar with C++, so I didn’t open a PR.
Just wanted to report this so you can double-check and fix it. 🙏
Linked: commitid: f3bf4b8
f3bf4b8
Self grab
Is there an existing issue for this?
Current Behavior
On Windows, setting
does not take effect — the background remains white.
Expected Behavior
transparentbackground
Steps with code example to reproduce
Set
Run on Windows
Observe that the background is not transparent
Stacktrace/Logs
no logs
Flutter version
v3.32.6
Operating System, Device-specific and/or Tool
windows
Plugin version
v6.1.4
Additional information
🔍 Issue Analysis
1️⃣ File
windows/flutter/ephemeral/.plugin_symlinks/flutter_inappwebview_windows/windows/in_app_webview/in_app_webview.cppLines 208–213:
The logic for transparentBackground is inverted here.
It should apply a transparent background when transparentBackground == true, not the opposite.
2️⃣ Same file, lines 1441–1445:
Here,
newSettings->transparentBackgroundis always false,so alpha never becomes 0.
When I forced
alpha = 0, the transparent background worked correctly.Notes
I’m not very familiar with C++, so I didn’t open a PR.
Just wanted to report this so you can double-check and fix it. 🙏
Linked: commitid:
f3bf4b8f3bf4b8
Self grab