mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-12-14 12:07:35 +00:00
feat: can resize window when without title bar
Signed-off-by: Kingtous <kingtous@qq.com>
This commit is contained in:
@@ -72,34 +72,37 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Column(
|
||||
children: [
|
||||
Obx(() => Visibility(
|
||||
visible: _fullscreenID.value.isEmpty,
|
||||
child: DesktopTabBar(
|
||||
tabs: tabs,
|
||||
onTabClose: onRemoveId,
|
||||
dark: isDarkTheme(),
|
||||
mainTab: false,
|
||||
))),
|
||||
Expanded(child: Obx(() {
|
||||
WindowController.fromWindowId(windowId())
|
||||
.setFullscreen(_fullscreenID.value.isNotEmpty);
|
||||
return PageView(
|
||||
controller: DesktopTabBar.controller.value,
|
||||
children: tabs
|
||||
.map((tab) => RemotePage(
|
||||
key: ValueKey(tab.label),
|
||||
id: tab.label,
|
||||
tabBarHeight: _fullscreenID.value.isNotEmpty
|
||||
? 0
|
||||
: kDesktopRemoteTabBarHeight,
|
||||
fullscreenID: _fullscreenID,
|
||||
)) //RemotePage(key: ValueKey(e), id: e))
|
||||
.toList());
|
||||
})),
|
||||
],
|
||||
return SubWindowDragToResizeArea(
|
||||
windowId: windowId(),
|
||||
child: Scaffold(
|
||||
body: Column(
|
||||
children: [
|
||||
Obx(() => Visibility(
|
||||
visible: _fullscreenID.value.isEmpty,
|
||||
child: DesktopTabBar(
|
||||
tabs: tabs,
|
||||
onTabClose: onRemoveId,
|
||||
dark: isDarkTheme(),
|
||||
mainTab: false,
|
||||
))),
|
||||
Expanded(child: Obx(() {
|
||||
WindowController.fromWindowId(windowId())
|
||||
.setFullscreen(_fullscreenID.value.isNotEmpty);
|
||||
return PageView(
|
||||
controller: DesktopTabBar.controller.value,
|
||||
children: tabs
|
||||
.map((tab) => RemotePage(
|
||||
key: ValueKey(tab.label),
|
||||
id: tab.label,
|
||||
tabBarHeight: _fullscreenID.value.isNotEmpty
|
||||
? 0
|
||||
: kDesktopRemoteTabBarHeight,
|
||||
fullscreenID: _fullscreenID,
|
||||
)) //RemotePage(key: ValueKey(e), id: e))
|
||||
.toList());
|
||||
})),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ 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:get/get.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
class DesktopTabPage extends StatefulWidget {
|
||||
const DesktopTabPage({Key? key}) : super(key: key);
|
||||
@@ -30,34 +31,36 @@ class _DesktopTabPageState extends State<DesktopTabPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: MyTheme.color(context).border!)),
|
||||
child: Scaffold(
|
||||
backgroundColor: MyTheme.color(context).bg,
|
||||
body: Column(
|
||||
children: [
|
||||
DesktopTabBar(
|
||||
tabs: tabs,
|
||||
dark: isDarkTheme(),
|
||||
mainTab: true,
|
||||
onAddSetting: onAddSetting,
|
||||
),
|
||||
Obx((() => Expanded(
|
||||
child: PageView(
|
||||
controller: DesktopTabBar.controller.value,
|
||||
children: tabs.map((tab) {
|
||||
switch (tab.label) {
|
||||
case kTabLabelHomePage:
|
||||
return DesktopHomePage(key: ValueKey(tab.label));
|
||||
case kTabLabelSettingPage:
|
||||
return DesktopSettingPage(key: ValueKey(tab.label));
|
||||
default:
|
||||
return Container();
|
||||
}
|
||||
}).toList()),
|
||||
))),
|
||||
],
|
||||
return DragToResizeArea(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: MyTheme.color(context).border!)),
|
||||
child: Scaffold(
|
||||
backgroundColor: MyTheme.color(context).bg,
|
||||
body: Column(
|
||||
children: [
|
||||
DesktopTabBar(
|
||||
tabs: tabs,
|
||||
dark: isDarkTheme(),
|
||||
mainTab: true,
|
||||
onAddSetting: onAddSetting,
|
||||
),
|
||||
Obx((() => Expanded(
|
||||
child: PageView(
|
||||
controller: DesktopTabBar.controller.value,
|
||||
children: tabs.map((tab) {
|
||||
switch (tab.label) {
|
||||
case kTabLabelHomePage:
|
||||
return DesktopHomePage(key: ValueKey(tab.label));
|
||||
case kTabLabelSettingPage:
|
||||
return DesktopSettingPage(key: ValueKey(tab.label));
|
||||
default:
|
||||
return Container();
|
||||
}
|
||||
}).toList()),
|
||||
))),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -68,27 +68,31 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Column(
|
||||
children: [
|
||||
DesktopTabBar(
|
||||
tabs: tabs,
|
||||
onTabClose: onRemoveId,
|
||||
dark: isDarkTheme(),
|
||||
mainTab: false,
|
||||
),
|
||||
Expanded(
|
||||
child: Obx(
|
||||
() => PageView(
|
||||
controller: DesktopTabBar.controller.value,
|
||||
children: tabs
|
||||
.map((tab) => FileManagerPage(
|
||||
key: ValueKey(tab.label),
|
||||
id: tab.label)) //RemotePage(key: ValueKey(e), id: e))
|
||||
.toList()),
|
||||
return SubWindowDragToResizeArea(
|
||||
windowId: windowId(),
|
||||
child: Scaffold(
|
||||
body: Column(
|
||||
children: [
|
||||
DesktopTabBar(
|
||||
tabs: tabs,
|
||||
onTabClose: onRemoveId,
|
||||
dark: isDarkTheme(),
|
||||
mainTab: false,
|
||||
),
|
||||
)
|
||||
],
|
||||
Expanded(
|
||||
child: Obx(
|
||||
() => PageView(
|
||||
controller: DesktopTabBar.controller.value,
|
||||
children: tabs
|
||||
.map((tab) => FileManagerPage(
|
||||
key: ValueKey(tab.label),
|
||||
id: tab
|
||||
.label)) //RemotePage(key: ValueKey(e), id: e))
|
||||
.toList()),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user