Merge pull request #1229 from Kingtous/flutter_desktop
feat: add focus with restore
This commit is contained in:
commit
26ed41ed32
@ -1,6 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:desktop_multi_window/desktop_multi_window.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
@ -110,10 +111,15 @@ backToHome() {
|
|||||||
Navigator.popUntil(globalKey.currentContext!, ModalRoute.withName("/"));
|
Navigator.popUntil(globalKey.currentContext!, ModalRoute.withName("/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void window_on_top() {
|
void window_on_top(int? id) {
|
||||||
|
if (id == null) {
|
||||||
|
// main window
|
||||||
windowManager.restore();
|
windowManager.restore();
|
||||||
windowManager.show();
|
windowManager.show();
|
||||||
windowManager.focus();
|
windowManager.focus();
|
||||||
|
} else {
|
||||||
|
WindowController.fromWindowId(id)..focus()..show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef DialogBuilder = CustomAlertDialog Function(
|
typedef DialogBuilder = CustomAlertDialog Function(
|
||||||
|
@ -49,9 +49,9 @@ class _ConnectionTabPageState extends State<ConnectionTabPage>
|
|||||||
"call ${call.method} with args ${call.arguments} from window ${fromWindowId}");
|
"call ${call.method} with args ${call.arguments} from window ${fromWindowId}");
|
||||||
// for simplify, just replace connectionId
|
// for simplify, just replace connectionId
|
||||||
if (call.method == "new_remote_desktop") {
|
if (call.method == "new_remote_desktop") {
|
||||||
window_on_top();
|
|
||||||
final args = jsonDecode(call.arguments);
|
final args = jsonDecode(call.arguments);
|
||||||
final id = args['id'];
|
final id = args['id'];
|
||||||
|
window_on_top(windowId());
|
||||||
final indexOf = connectionIds.indexOf(id);
|
final indexOf = connectionIds.indexOf(id);
|
||||||
if (indexOf >= 0) {
|
if (indexOf >= 0) {
|
||||||
initialIndex = indexOf;
|
initialIndex = indexOf;
|
||||||
|
@ -472,7 +472,7 @@ class _DesktopHomePageState extends State<DesktopHomePage> with TrayListener, Wi
|
|||||||
print(
|
print(
|
||||||
"call ${call.method} with args ${call.arguments} from window ${fromWindowId}");
|
"call ${call.method} with args ${call.arguments} from window ${fromWindowId}");
|
||||||
if (call.method == "main_window_on_top") {
|
if (call.method == "main_window_on_top") {
|
||||||
window_on_top();
|
window_on_top(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -46,9 +46,9 @@ class _FileManagerTabPageState extends State<FileManagerTabPage>
|
|||||||
"call ${call.method} with args ${call.arguments} from window ${fromWindowId}");
|
"call ${call.method} with args ${call.arguments} from window ${fromWindowId}");
|
||||||
// for simplify, just replace connectionId
|
// for simplify, just replace connectionId
|
||||||
if (call.method == "new_file_transfer") {
|
if (call.method == "new_file_transfer") {
|
||||||
window_on_top();
|
|
||||||
final args = jsonDecode(call.arguments);
|
final args = jsonDecode(call.arguments);
|
||||||
final id = args['id'];
|
final id = args['id'];
|
||||||
|
window_on_top(windowId());
|
||||||
final indexOf = connectionIds.indexOf(id);
|
final indexOf = connectionIds.indexOf(id);
|
||||||
if (indexOf >= 0) {
|
if (indexOf >= 0) {
|
||||||
initialIndex = indexOf;
|
initialIndex = indexOf;
|
||||||
|
@ -236,8 +236,8 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: ce9e333d822fe6cbf91c8634bae023bf78700d94
|
ref: bbe24b8af079a756f2d39158dd2034127f0e1c73
|
||||||
resolved-ref: ce9e333d822fe6cbf91c8634bae023bf78700d94
|
resolved-ref: bbe24b8af079a756f2d39158dd2034127f0e1c73
|
||||||
url: "https://github.com/Kingtous/rustdesk_desktop_multi_window"
|
url: "https://github.com/Kingtous/rustdesk_desktop_multi_window"
|
||||||
source: git
|
source: git
|
||||||
version: "0.1.0"
|
version: "0.1.0"
|
||||||
|
@ -62,7 +62,7 @@ dependencies:
|
|||||||
desktop_multi_window:
|
desktop_multi_window:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Kingtous/rustdesk_desktop_multi_window
|
url: https://github.com/Kingtous/rustdesk_desktop_multi_window
|
||||||
ref: ce9e333d822fe6cbf91c8634bae023bf78700d94
|
ref: c53879e9ce4ed038af393a02bf2c7084ad4b53aa
|
||||||
# bitsdojo_window: ^0.1.2
|
# bitsdojo_window: ^0.1.2
|
||||||
freezed_annotation: ^2.0.3
|
freezed_annotation: ^2.0.3
|
||||||
tray_manager: 0.1.7
|
tray_manager: 0.1.7
|
||||||
|
Loading…
x
Reference in New Issue
Block a user