fix: method channel in multi window context

Signed-off-by: Kingtous <kingtous@qq.com>
This commit is contained in:
Kingtous 2022-05-31 12:09:47 +08:00
parent 7af663809f
commit ac09c37516
3 changed files with 13 additions and 19 deletions

View File

@ -7,6 +7,7 @@ import 'package:flutter_hbb/desktop/screen/desktop_remote_screen.dart';
import 'package:flutter_hbb/utils/multi_window_manager.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:provider/provider.dart';
import 'package:window_manager/window_manager.dart';
import 'common.dart';
import 'mobile/pages/home_page.dart';
@ -32,6 +33,8 @@ void runRustDeskApp(List<String> args) async {
runApp(App());
return;
}
// main window
await windowManager.ensureInitialized();
if (args.isNotEmpty && args.first == 'multi_window') {
windowId = int.parse(args[1]);
final argument = args[2].isEmpty
@ -49,21 +52,7 @@ void runRustDeskApp(List<String> args) async {
break;
}
} else {
// main window
// await windowManager.ensureInitialized();
// start service
FFI.serverModel.startService();
// WindowOptions windowOptions = WindowOptions(
// size: Size(1280, 720),
// center: true,
// backgroundColor: Colors.transparent,
// skipTaskbar: false,
// titleBarStyle: TitleBarStyle.normal,
// );
// windowManager.waitUntilReadyToShow(windowOptions, () async {
// await windowManager.show();
// await windowManager.focus();
// });
runApp(App());
doWhenWindowReady(() {
const initialSize = Size(1280, 720);

View File

@ -123,10 +123,12 @@ packages:
desktop_multi_window:
dependency: "direct main"
description:
name: desktop_multi_window
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.2"
path: "."
ref: master
resolved-ref: "7150283dcd0c79450b98bf0a62b26df95897e53c"
url: "https://github.com/Kingtous/rustdesk_desktop_multi_window"
source: git
version: "0.0.1"
device_info_plus:
dependency: "direct main"
description:

View File

@ -56,7 +56,10 @@ dependencies:
flutter_smart_dialog: ^4.3.1
flutter_rust_bridge: ^1.30.0
window_manager: ^0.2.3
desktop_multi_window: ^0.0.2
desktop_multi_window:
git:
url: https://github.com/Kingtous/rustdesk_desktop_multi_window
ref: master
bitsdojo_window: ^0.1.2
dev_dependencies: