2022-09-19 10:14:14 +08:00
|
|
|
import 'dart:io';
|
|
|
|
|
2022-08-11 16:03:04 +08:00
|
|
|
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';
|
Feat. Quick support, ui (#7267)
* 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>
2024-02-27 17:02:10 +08:00
|
|
|
import 'package:flutter_hbb/models/platform_model.dart';
|
2022-11-01 17:01:43 +08:00
|
|
|
import 'package:flutter_hbb/models/state_model.dart';
|
2022-08-26 23:28:08 +08:00
|
|
|
import 'package:get/get.dart';
|
2022-08-22 13:51:05 +08:00
|
|
|
import 'package:window_manager/window_manager.dart';
|
2022-08-11 16:03:04 +08:00
|
|
|
|
2022-10-08 17:27:30 +08:00
|
|
|
import '../../common/shared_state.dart';
|
|
|
|
|
2022-08-11 16:03:04 +08:00
|
|
|
class DesktopTabPage extends StatefulWidget {
|
|
|
|
const DesktopTabPage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<DesktopTabPage> createState() => _DesktopTabPageState();
|
2022-09-23 18:28:40 +08:00
|
|
|
|
|
|
|
static void onAddSetting({int initialPage = 0}) {
|
|
|
|
try {
|
|
|
|
DesktopTabController tabController = Get.find();
|
|
|
|
tabController.add(TabInfo(
|
|
|
|
key: kTabLabelSettingPage,
|
2023-03-24 17:39:31 +08:00
|
|
|
label: kTabLabelSettingPage,
|
2022-09-23 18:28:40 +08:00
|
|
|
selectedIcon: Icons.build_sharp,
|
|
|
|
unselectedIcon: Icons.build_outlined,
|
|
|
|
page: DesktopSettingPage(
|
|
|
|
key: const ValueKey(kTabLabelSettingPage),
|
|
|
|
initialPage: initialPage,
|
|
|
|
)));
|
|
|
|
} catch (e) {
|
2022-12-09 10:49:47 +08:00
|
|
|
debugPrintStack(label: '$e');
|
2022-09-23 18:28:40 +08:00
|
|
|
}
|
|
|
|
}
|
2022-08-11 16:03:04 +08:00
|
|
|
}
|
|
|
|
|
2022-08-18 10:54:09 +08:00
|
|
|
class _DesktopTabPageState extends State<DesktopTabPage> {
|
2022-09-01 21:18:53 +08:00
|
|
|
final tabController = DesktopTabController(tabType: DesktopTabType.main);
|
2022-08-11 16:03:04 +08:00
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
2022-09-23 18:28:40 +08:00
|
|
|
Get.put<DesktopTabController>(tabController);
|
2022-10-08 17:27:30 +08:00
|
|
|
RemoteCountState.init();
|
2022-08-26 12:14:14 +08:00
|
|
|
tabController.add(TabInfo(
|
2022-08-24 20:12:04 +08:00
|
|
|
key: kTabLabelHomePage,
|
2023-03-24 17:39:31 +08:00
|
|
|
label: kTabLabelHomePage,
|
2022-08-24 20:12:04 +08:00
|
|
|
selectedIcon: Icons.home_sharp,
|
|
|
|
unselectedIcon: Icons.home_outlined,
|
|
|
|
closable: false,
|
2022-08-26 12:14:14 +08:00
|
|
|
page: DesktopHomePage(
|
|
|
|
key: const ValueKey(kTabLabelHomePage),
|
|
|
|
)));
|
2024-03-12 21:47:29 +08:00
|
|
|
if (bind.isIncomingOnly()) {
|
Feat. Quick support, ui (#7267)
* 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>
2024-02-27 17:02:10 +08:00
|
|
|
tabController.onSelected = (key) {
|
|
|
|
if (key == kTabLabelHomePage) {
|
Fix/custom client styles (#7373)
* Fix. qs styles
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Move logo.svg to icon.svg
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Refact. Custom client, connection status ui.
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client ui. Disable settings, hide "Change password"
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client, logo align center
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client, refact, outgoing ui
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client, outgoing, settings icon
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client, powered by RustDesk
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client, remove unused SizeBox
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Update config.rs
* Update flutter_ffi.rs
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
2024-03-14 11:36:14 +08:00
|
|
|
windowManager.setSize(getIncomingOnlyHomeSize());
|
Feat. Quick support, ui (#7267)
* 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>
2024-02-27 17:02:10 +08:00
|
|
|
windowManager.setResizable(false);
|
|
|
|
} else {
|
Fix/custom client styles (#7373)
* Fix. qs styles
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Move logo.svg to icon.svg
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Refact. Custom client, connection status ui.
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client ui. Disable settings, hide "Change password"
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client, logo align center
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client, refact, outgoing ui
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client, outgoing, settings icon
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client, powered by RustDesk
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client, remove unused SizeBox
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Update config.rs
* Update flutter_ffi.rs
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
2024-03-14 11:36:14 +08:00
|
|
|
windowManager.setSize(getIncomingOnlySettingsSize());
|
Feat. Quick support, ui (#7267)
* 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>
2024-02-27 17:02:10 +08:00
|
|
|
windowManager.setResizable(true);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2022-08-11 16:03:04 +08:00
|
|
|
}
|
|
|
|
|
2022-09-23 18:28:40 +08:00
|
|
|
@override
|
|
|
|
void dispose() {
|
|
|
|
super.dispose();
|
|
|
|
Get.delete<DesktopTabController>();
|
|
|
|
}
|
|
|
|
|
2022-08-11 16:03:04 +08:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2022-09-19 10:14:14 +08:00
|
|
|
final tabWidget = Container(
|
2023-02-08 20:54:48 +08:00
|
|
|
child: Scaffold(
|
2023-02-23 23:49:31 +08:00
|
|
|
backgroundColor: Theme.of(context).colorScheme.background,
|
2023-02-08 20:54:48 +08:00
|
|
|
body: DesktopTab(
|
|
|
|
controller: tabController,
|
Feat. Quick support, ui (#7267)
* 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>
2024-02-27 17:02:10 +08:00
|
|
|
tail: Offstage(
|
Fix/custom client styles (#7373)
* Fix. qs styles
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* custom client, options
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Move logo.svg to icon.svg
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Refact. Custom client, connection status ui.
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client ui. Disable settings, hide "Change password"
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client, logo align center
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client, refact, outgoing ui
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client, outgoing, settings icon
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client, powered by RustDesk
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Custom client, remove unused SizeBox
Signed-off-by: fufesou <shuanglongchen@yeah.net>
* Update config.rs
* Update flutter_ffi.rs
---------
Signed-off-by: fufesou <shuanglongchen@yeah.net>
Co-authored-by: RustDesk <71636191+rustdesk@users.noreply.github.com>
2024-03-14 11:36:14 +08:00
|
|
|
offstage: bind.isIncomingOnly() || bind.isDisableSettings(),
|
Feat. Quick support, ui (#7267)
* 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>
2024-02-27 17:02:10 +08:00
|
|
|
child: ActionIcon(
|
|
|
|
message: 'Settings',
|
|
|
|
icon: IconFont.menu,
|
|
|
|
onTap: DesktopTabPage.onAddSetting,
|
|
|
|
isClose: false,
|
|
|
|
),
|
2023-02-08 20:54:48 +08:00
|
|
|
),
|
|
|
|
)));
|
2023-02-27 15:56:09 +08:00
|
|
|
return Platform.isMacOS || kUseCompatibleUiMode
|
2022-09-19 10:14:14 +08:00
|
|
|
? tabWidget
|
2022-11-01 18:16:52 +08:00
|
|
|
: Obx(
|
|
|
|
() => DragToResizeArea(
|
|
|
|
resizeEdgeSize: stateGlobal.resizeEdgeSize.value,
|
|
|
|
child: tabWidget,
|
|
|
|
),
|
|
|
|
);
|
2022-08-11 16:03:04 +08:00
|
|
|
}
|
|
|
|
}
|