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

@@ -34,6 +34,7 @@ class _MainAppState extends State<MainApp>
with RouteAware, WidgetsBindingObserver, WindowListener, TrayListener {
final MainController _mainController = Get.put(MainController());
late final _setting = GStorage.setting;
static const MethodChannel _channel = MethodChannel('window_control');
@override
void initState() {
@@ -131,6 +132,14 @@ class _MainAppState extends State<MainApp>
void onWindowClose() {
if (_mainController.minimizeOnExit) {
windowManager.hide();
} else {
_onClose();
}
}
void _onClose() {
if (Platform.isWindows) {
_channel.invokeMethod('closeWindow');
} else {
exit(0);
}
@@ -157,7 +166,7 @@ class _MainAppState extends State<MainApp>
case 'show':
windowManager.show();
case 'exit':
exit(0);
_onClose();
}
}