mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-12-05 04:59:05 +08:00
e6953c8883
* Feat. QS ui Signed-off-by: fufesou <shuanglongchen@yeah.net> * Remove 'Quick support' Signed-off-by: fufesou <shuanglongchen@yeah.net> * add help card Signed-off-by: fufesou <shuanglongchen@yeah.net> * use addPostFrameCallback to get child size Signed-off-by: fufesou <shuanglongchen@yeah.net> * Fix. qs, set home window size Signed-off-by: fufesou <shuanglongchen@yeah.net> * Qs, set setResizable for settings page Signed-off-by: fufesou <shuanglongchen@yeah.net> * Qs, help cards margin bottom Signed-off-by: fufesou <shuanglongchen@yeah.net> * Qs, online status, padding Signed-off-by: fufesou <shuanglongchen@yeah.net> * Qs, online status, padding Signed-off-by: fufesou <shuanglongchen@yeah.net> * Qs, online status, use margin instead of padding Signed-off-by: fufesou <shuanglongchen@yeah.net> * Qs, fix, start cm window Signed-off-by: fufesou <shuanglongchen@yeah.net> --------- Signed-off-by: fufesou <shuanglongchen@yeah.net>
103 lines
3.1 KiB
Dart
103 lines
3.1 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_hbb/common.dart';
|
|
import 'package:flutter_hbb/consts.dart';
|
|
import 'package:flutter_hbb/desktop/pages/desktop_home_page.dart';
|
|
import 'package:flutter_hbb/desktop/pages/desktop_setting_page.dart';
|
|
import 'package:flutter_hbb/desktop/widgets/tabbar_widget.dart';
|
|
import 'package:flutter_hbb/models/platform_model.dart';
|
|
import 'package:flutter_hbb/models/state_model.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);
|
|
|
|
@override
|
|
State<DesktopTabPage> createState() => _DesktopTabPageState();
|
|
|
|
static void onAddSetting({int initialPage = 0}) {
|
|
try {
|
|
DesktopTabController tabController = Get.find();
|
|
tabController.add(TabInfo(
|
|
key: kTabLabelSettingPage,
|
|
label: kTabLabelSettingPage,
|
|
selectedIcon: Icons.build_sharp,
|
|
unselectedIcon: Icons.build_outlined,
|
|
page: DesktopSettingPage(
|
|
key: const ValueKey(kTabLabelSettingPage),
|
|
initialPage: initialPage,
|
|
)));
|
|
} catch (e) {
|
|
debugPrintStack(label: '$e');
|
|
}
|
|
}
|
|
}
|
|
|
|
class _DesktopTabPageState extends State<DesktopTabPage> {
|
|
final tabController = DesktopTabController(tabType: DesktopTabType.main);
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
Get.put<DesktopTabController>(tabController);
|
|
RemoteCountState.init();
|
|
tabController.add(TabInfo(
|
|
key: kTabLabelHomePage,
|
|
label: kTabLabelHomePage,
|
|
selectedIcon: Icons.home_sharp,
|
|
unselectedIcon: Icons.home_outlined,
|
|
closable: false,
|
|
page: DesktopHomePage(
|
|
key: const ValueKey(kTabLabelHomePage),
|
|
)));
|
|
if (bind.isQs()) {
|
|
tabController.onSelected = (key) {
|
|
if (key == kTabLabelHomePage) {
|
|
windowManager.setSize(getDesktopQsHomeSize());
|
|
windowManager.setResizable(false);
|
|
} else {
|
|
windowManager.setSize(getDesktopQsSettingsSize());
|
|
windowManager.setResizable(true);
|
|
}
|
|
};
|
|
}
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
Get.delete<DesktopTabController>();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final tabWidget = Container(
|
|
child: Scaffold(
|
|
backgroundColor: Theme.of(context).colorScheme.background,
|
|
body: DesktopTab(
|
|
controller: tabController,
|
|
tail: Offstage(
|
|
offstage: bind.isQs(),
|
|
child: ActionIcon(
|
|
message: 'Settings',
|
|
icon: IconFont.menu,
|
|
onTap: DesktopTabPage.onAddSetting,
|
|
isClose: false,
|
|
),
|
|
),
|
|
)));
|
|
return Platform.isMacOS || kUseCompatibleUiMode
|
|
? tabWidget
|
|
: Obx(
|
|
() => DragToResizeArea(
|
|
resizeEdgeSize: stateGlobal.resizeEdgeSize.value,
|
|
child: tabWidget,
|
|
),
|
|
);
|
|
}
|
|
}
|