desktop block remote click chat page
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
7c4c69aa75
commit
87e06e974e
@ -2110,3 +2110,33 @@ Future<void> start_service(bool is_start) async {
|
|||||||
bind.mainSetOption(key: "stop-service", value: is_start ? "" : "Y");
|
bind.mainSetOption(key: "stop-service", value: is_start ? "" : "Y");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef Future<bool> WhetherUseRemoteBlock();
|
||||||
|
Widget buildRemoteBlock({required Widget child, WhetherUseRemoteBlock? use}) {
|
||||||
|
var block = false.obs;
|
||||||
|
return Obx(() => MouseRegion(
|
||||||
|
onEnter: (_) async {
|
||||||
|
if (use != null && !await use()) {
|
||||||
|
block.value = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var time0 = DateTime.now().millisecondsSinceEpoch;
|
||||||
|
await bind.mainCheckMouseTime();
|
||||||
|
Timer(const Duration(milliseconds: 120), () async {
|
||||||
|
var d = time0 - await bind.mainGetMouseTime();
|
||||||
|
if (d < 120) {
|
||||||
|
block.value = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onExit: (event) => block.value = false,
|
||||||
|
child: Stack(children: [
|
||||||
|
child,
|
||||||
|
Offstage(
|
||||||
|
offstage: !block.value,
|
||||||
|
child: Container(
|
||||||
|
color: Colors.black.withOpacity(0.5),
|
||||||
|
)),
|
||||||
|
]),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
@ -184,7 +184,9 @@ class ConnectionManagerState extends State<ConnectionManager> {
|
|||||||
Consumer<ChatModel>(
|
Consumer<ChatModel>(
|
||||||
builder: (_, model, child) => model.isShowCMChatPage
|
builder: (_, model, child) => model.isShowCMChatPage
|
||||||
? Expanded(
|
? Expanded(
|
||||||
child: ChatPage(),
|
child: buildRemoteBlock(
|
||||||
|
child: ChatPage(),
|
||||||
|
),
|
||||||
flex: (kConnectionManagerWindowSizeOpenChat.width -
|
flex: (kConnectionManagerWindowSizeOpenChat.width -
|
||||||
kConnectionManagerWindowSizeClosedChat
|
kConnectionManagerWindowSizeClosedChat
|
||||||
.width)
|
.width)
|
||||||
|
@ -295,37 +295,16 @@ class DesktopTab extends StatelessWidget {
|
|||||||
if (tabType != DesktopTabType.main) {
|
if (tabType != DesktopTabType.main) {
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
var block = false.obs;
|
return buildRemoteBlock(
|
||||||
return Obx(() => MouseRegion(
|
child: child,
|
||||||
onEnter: (_) async {
|
use: () async {
|
||||||
var access_mode = await bind.mainGetOption(key: 'access-mode');
|
var access_mode = await bind.mainGetOption(key: 'access-mode');
|
||||||
var option = option2bool(
|
var option = option2bool(
|
||||||
'allow-remote-config-modification',
|
'allow-remote-config-modification',
|
||||||
await bind.mainGetOption(
|
await bind.mainGetOption(
|
||||||
key: 'allow-remote-config-modification'));
|
key: 'allow-remote-config-modification'));
|
||||||
if (access_mode == 'view' || (access_mode.isEmpty && !option)) {
|
return access_mode == 'view' || (access_mode.isEmpty && !option);
|
||||||
var time0 = DateTime.now().millisecondsSinceEpoch;
|
});
|
||||||
await bind.mainCheckMouseTime();
|
|
||||||
Timer(const Duration(milliseconds: 120), () async {
|
|
||||||
var d = time0 - await bind.mainGetMouseTime();
|
|
||||||
if (d < 120) {
|
|
||||||
block.value = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onExit: (_) => block.value = false,
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
child,
|
|
||||||
Offstage(
|
|
||||||
offstage: !block.value,
|
|
||||||
child: Container(
|
|
||||||
color: Colors.black.withOpacity(0.5),
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> _tabWidgets = [];
|
List<Widget> _tabWidgets = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user