windows webview

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-09-26 17:53:48 +08:00
parent 93e64a0988
commit 59fd89ae5d
7 changed files with 82 additions and 17 deletions

View File

@@ -4,6 +4,9 @@
#include "flutter/generated_plugin_registrant.h"
#include <flutter/method_channel.h>
#include <flutter/standard_method_codec.h>
FlutterWindow::FlutterWindow(const flutter::DartProject& project)
: project_(project) {}
@@ -25,6 +28,25 @@ bool FlutterWindow::OnCreate() {
return false;
}
RegisterPlugins(flutter_controller_->engine());
// flutter_inappwebview
// 6.2.0-beta.2+ https://github.com/pichillilorenzo/flutter_inappwebview/issues/2482
// 6.1.5 https://github.com/pichillilorenzo/flutter_inappwebview/issues/2512#issuecomment-3031039587
flutter::MethodChannel<> channel(
flutter_controller_->engine()->messenger(), "window_control",
&flutter::StandardMethodCodec::GetInstance());
channel.SetMethodCallHandler(
[](const flutter::MethodCall<>& call,
std::unique_ptr<flutter::MethodResult<>> result) {
if (call.method_name().compare("closeWindow") == 0) {
HANDLE hProcess = GetCurrentProcess();
TerminateProcess(hProcess, 0);
result->Success();
} else {
result->NotImplemented();
}
});
SetChildContent(flutter_controller_->view()->GetNativeWindow());
flutter_controller_->engine()->SetNextFrameCallback([&]() {