mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-14 12:07:35 +00:00
flutter_desktop: check remote menu, mid commit
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
28
flutter/lib/desktop/widgets/utils.dart
Normal file
28
flutter/lib/desktop/widgets/utils.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hbb/utils/multi_window_manager.dart';
|
||||
|
||||
/// Connect to a peer with [id].
|
||||
/// If [isFileTransfer], starts a session only for file transfer.
|
||||
/// If [isTcpTunneling], starts a session only for tcp tunneling.
|
||||
/// If [isRDP], starts a session only for rdp.
|
||||
void connect(BuildContext context, String id,
|
||||
{bool isFileTransfer = false,
|
||||
bool isTcpTunneling = false,
|
||||
bool isRDP = false}) async {
|
||||
if (id == '') return;
|
||||
id = id.replaceAll(' ', '');
|
||||
assert(!(isFileTransfer && isTcpTunneling && isRDP),
|
||||
"more than one connect type");
|
||||
|
||||
FocusScopeNode currentFocus = FocusScope.of(context);
|
||||
if (isFileTransfer) {
|
||||
await rustDeskWinManager.newFileTransfer(id);
|
||||
} else if (isTcpTunneling || isRDP) {
|
||||
await rustDeskWinManager.newPortForward(id, isRDP);
|
||||
} else {
|
||||
await rustDeskWinManager.newRemoteDesktop(id);
|
||||
}
|
||||
if (!currentFocus.hasPrimaryFocus) {
|
||||
currentFocus.unfocus();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user