mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-23 04:00:28 +08:00
windows webview
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:PiliPlus/http/ua_type.dart';
|
||||
import 'package:PiliPlus/main.dart';
|
||||
import 'package:PiliPlus/models/common/webview_menu_type.dart';
|
||||
import 'package:PiliPlus/utils/app_scheme.dart';
|
||||
import 'package:PiliPlus/utils/cache_manage.dart';
|
||||
@@ -60,7 +61,7 @@ class _WebviewPageState extends State<WebviewPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (Platform.isWindows || Platform.isLinux) {
|
||||
if (Platform.isLinux) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(),
|
||||
body: Center(
|
||||
@@ -156,6 +157,7 @@ class _WebviewPageState extends State<WebviewPage> {
|
||||
),
|
||||
body: SafeArea(
|
||||
child: InAppWebView(
|
||||
webViewEnvironment: webViewEnvironment,
|
||||
initialSettings: InAppWebViewSettings(
|
||||
clearCache: true,
|
||||
javaScriptEnabled: true,
|
||||
|
||||
Reference in New Issue
Block a user