refactor: move peer_widget / peercard_widget / peer_tab_page & move connect

new address_book class; add peer tab onPageChanged

android settings_page.dart add dark mode

opt peer_tab_page search bar, add mobile peer_tab support
This commit is contained in:
csf
2022-09-19 20:26:39 +08:00
parent 0c407994cd
commit 9e6e842247
12 changed files with 927 additions and 868 deletions

View File

@@ -1007,3 +1007,29 @@ Future<bool> restoreWindowPosition(WindowType type, {int? windowId}) async {
}
return false;
}
/// 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();
}
}