impl option remote modification

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages
2022-08-30 16:50:25 +08:00
parent 839be76b8f
commit 38abd27384
9 changed files with 109 additions and 33 deletions

View File

@@ -93,7 +93,7 @@ class _ConnectionTabPageState extends State<ConnectionTabPage> {
body: Obx(() => DesktopTab(
controller: tabController,
theme: theme,
isMainWindow: false,
tabType: DesktopTabType.remoteScreen,
showTabBar: fullscreen.isFalse,
onClose: () {
tabController.clear();

View File

@@ -46,7 +46,7 @@ class _DesktopTabPageState extends State<DesktopTabPage> {
body: DesktopTab(
controller: tabController,
theme: dark ? TarBarTheme.dark() : TarBarTheme.light(),
isMainWindow: true,
tabType: DesktopTabType.main,
tail: ActionIcon(
message: 'Settings',
icon: IconFont.menu,

View File

@@ -37,7 +37,7 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
@override
void initState() {
super.initState();
tabController.onRemove = (_, id) => onRemoveId(id);
rustDeskWinManager.setMethodHandler((call, fromWindowId) async {
@@ -74,9 +74,9 @@ class _FileManagerTabPageState extends State<FileManagerTabPage> {
body: DesktopTab(
controller: tabController,
theme: theme,
isMainWindow: false,
tabType: DesktopTabType.fileTransfer,
onClose: () {
tabController.clear();
tabController.clear();
},
tail: AddButton(
theme: theme,

View File

@@ -19,11 +19,13 @@ class PortForwardTabPage extends StatefulWidget {
class _PortForwardTabPageState extends State<PortForwardTabPage> {
final tabController = Get.put(DesktopTabController());
late final bool isRDP;
static final IconData selectedIcon = Icons.forward_sharp;
static final IconData unselectedIcon = Icons.forward_outlined;
static const IconData selectedIcon = Icons.forward_sharp;
static const IconData unselectedIcon = Icons.forward_outlined;
_PortForwardTabPageState(Map<String, dynamic> params) {
isRDP = params['isRDP'];
tabController.add(TabInfo(
key: params['id'],
label: params['id'],
@@ -32,7 +34,7 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
page: PortForwardPage(
key: ValueKey(params['id']),
id: params['id'],
isRDP: params['isRDP'],
isRDP: isRDP,
)));
}
@@ -76,7 +78,7 @@ class _PortForwardTabPageState extends State<PortForwardTabPage> {
body: DesktopTab(
controller: tabController,
theme: theme,
isMainWindow: false,
tabType: isRDP ? DesktopTabType.rdp : DesktopTabType.portForward,
onClose: () {
tabController.clear();
},

View File

@@ -111,7 +111,7 @@ class ConnectionManagerState extends State<ConnectionManager> {
showMaximize: false,
showMinimize: false,
controller: serverModel.tabController,
isMainWindow: true,
tabType: DesktopTabType.cm,
pageViewBuilder: (pageView) => Row(children: [
Expanded(child: pageView),
Consumer<ChatModel>(
@@ -294,7 +294,8 @@ class _CmHeaderState extends State<_CmHeader>
Offstage(
offstage: client.isFileTransfer,
child: IconButton(
onPressed: () => gFFI.chatModel.toggleCMChatPage(client.id),
onPressed: () => checkClickTime(
client.id, () => gFFI.chatModel.toggleCMChatPage(client.id)),
icon: Icon(Icons.message_outlined),
),
)
@@ -326,7 +327,8 @@ class _PrivilegeBoardState extends State<_PrivilegeBoard> {
BoxDecoration(color: enabled ? MyTheme.accent80 : Colors.grey),
padding: EdgeInsets.all(4.0),
child: InkWell(
onTap: () => onTap?.call(!enabled),
onTap: () =>
checkClickTime(widget.client.id, () => onTap?.call(!enabled)),
child: Image(
image: icon,
width: 50,
@@ -422,7 +424,8 @@ class _CmControlPanel extends StatelessWidget {
decoration: BoxDecoration(
color: Colors.redAccent, borderRadius: BorderRadius.circular(10)),
child: InkWell(
onTap: () => handleDisconnect(context),
onTap: () =>
checkClickTime(client.id, () => handleDisconnect(context)),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@@ -447,7 +450,8 @@ class _CmControlPanel extends StatelessWidget {
decoration: BoxDecoration(
color: MyTheme.accent, borderRadius: BorderRadius.circular(10)),
child: InkWell(
onTap: () => handleAccept(context),
onTap: () =>
checkClickTime(client.id, () => handleAccept(context)),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@@ -469,7 +473,8 @@ class _CmControlPanel extends StatelessWidget {
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.grey)),
child: InkWell(
onTap: () => handleDisconnect(context),
onTap: () =>
checkClickTime(client.id, () => handleDisconnect(context)),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@@ -572,3 +577,12 @@ Widget clientInfo(Client client) {
),
]));
}
void checkClickTime(int id, Function() callback) async {
var clickCallbackTime = DateTime.now().millisecondsSinceEpoch;
await bind.cmCheckClickTime(connId: id);
Timer(const Duration(milliseconds: 120), () async {
var d = clickCallbackTime - await bind.cmGetClickTime();
if (d > 120) callback();
});
}