mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-02 13:31:30 +03:00
flutter_desktop: adjust window
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
@@ -9,6 +9,8 @@ import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
import '../../common/shared_state.dart';
|
||||
|
||||
class DesktopTabPage extends StatefulWidget {
|
||||
const DesktopTabPage({Key? key}) : super(key: key);
|
||||
|
||||
@@ -40,6 +42,7 @@ class _DesktopTabPageState extends State<DesktopTabPage> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
Get.put<DesktopTabController>(tabController);
|
||||
RemoteCountState.init();
|
||||
tabController.add(TabInfo(
|
||||
key: kTabLabelHomePage,
|
||||
label: kTabLabelHomePage,
|
||||
|
||||
@@ -28,11 +28,13 @@ class RemotePage extends StatefulWidget {
|
||||
const RemotePage({
|
||||
Key? key,
|
||||
required this.id,
|
||||
required this.windowId,
|
||||
required this.tabBarHeight,
|
||||
required this.windowBorderWidth,
|
||||
}) : super(key: key);
|
||||
|
||||
final String id;
|
||||
final int windowId;
|
||||
final double tabBarHeight;
|
||||
final double windowBorderWidth;
|
||||
|
||||
@@ -239,6 +241,7 @@ class _RemotePageState extends State<RemotePage>
|
||||
paints.add(QualityMonitor(_ffi.qualityMonitorModel));
|
||||
paints.add(RemoteMenubar(
|
||||
id: widget.id,
|
||||
windowId: widget.windowId,
|
||||
ffi: _ffi,
|
||||
onEnterOrLeaveImageSetter: (func) => _onEnterOrLeaveImage4Menubar = func,
|
||||
onEnterOrLeaveImageCleaner: () => _onEnterOrLeaveImage4Menubar = null,
|
||||
|
||||
@@ -32,6 +32,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
var connectionMap = RxList<Widget>.empty(growable: true);
|
||||
|
||||
_ConnectionTabPageState(Map<String, dynamic> params) {
|
||||
RemoteCountState.init();
|
||||
final RxBool fullscreen = Get.find(tag: 'fullscreen');
|
||||
final peerId = params['id'];
|
||||
if (peerId != null) {
|
||||
@@ -45,10 +46,12 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
page: Obx(() => RemotePage(
|
||||
key: ValueKey(peerId),
|
||||
id: peerId,
|
||||
windowId: windowId(),
|
||||
tabBarHeight:
|
||||
fullscreen.isTrue ? 0 : kDesktopRemoteTabBarHeight,
|
||||
windowBorderWidth: fullscreen.isTrue ? 0 : kWindowBorderWidth,
|
||||
))));
|
||||
_update_remote_count();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,6 +82,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
page: Obx(() => RemotePage(
|
||||
key: ValueKey(id),
|
||||
id: id,
|
||||
windowId: windowId(),
|
||||
tabBarHeight:
|
||||
fullscreen.isTrue ? 0 : kDesktopRemoteTabBarHeight,
|
||||
windowBorderWidth: fullscreen.isTrue ? 0 : kWindowBorderWidth,
|
||||
@@ -86,6 +90,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
} else if (call.method == "onDestroy") {
|
||||
tabController.clear();
|
||||
}
|
||||
_update_remote_count();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -161,6 +166,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
WindowController.fromWindowId(windowId()).hide();
|
||||
}
|
||||
ConnectionTypeState.delete(id);
|
||||
_update_remote_count();
|
||||
}
|
||||
|
||||
int windowId() {
|
||||
@@ -178,7 +184,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
}
|
||||
|
||||
Future<bool> handleWindowCloseButton() async {
|
||||
final connLength = tabController.state.value.tabs.length;
|
||||
final connLength = tabController.length;
|
||||
if (connLength < 1) {
|
||||
return true;
|
||||
} else if (connLength == 1) {
|
||||
@@ -189,8 +195,12 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
final res = await closeConfirmDialog();
|
||||
if (res) {
|
||||
tabController.clear();
|
||||
_update_remote_count();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
_update_remote_count() =>
|
||||
RemoteCountState.find().value = tabController.length;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user