main window add block mask, cm add keyboard block (#8640)
* block window body only so user can still click minisize button. * cm doesn't show mask * Remove focusable Offstage in tabbar_widget.dart Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
@@ -2715,20 +2715,26 @@ Future<void> shouldBeBlocked(RxBool block, WhetherUseRemoteBlock? use) async {
|
||||
}
|
||||
|
||||
typedef WhetherUseRemoteBlock = Future<bool> Function();
|
||||
Widget buildRemoteBlock({required Widget child, WhetherUseRemoteBlock? use}) {
|
||||
var block = false.obs;
|
||||
Widget buildRemoteBlock(
|
||||
{required Widget child,
|
||||
required RxBool block,
|
||||
required bool mask,
|
||||
WhetherUseRemoteBlock? use}) {
|
||||
return Obx(() => MouseRegion(
|
||||
onEnter: (_) async {
|
||||
await shouldBeBlocked(block, use);
|
||||
},
|
||||
onExit: (event) => block.value = false,
|
||||
child: Stack(children: [
|
||||
child,
|
||||
Offstage(
|
||||
offstage: !block.value,
|
||||
child: Container(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
)),
|
||||
// scope block tab
|
||||
FocusScope(child: child, canRequestFocus: !block.value),
|
||||
// mask block click, cm not block click and still use check_click_time to avoid block local click
|
||||
if (mask)
|
||||
Offstage(
|
||||
offstage: !block.value,
|
||||
child: Container(
|
||||
color: Colors.black.withOpacity(0.5),
|
||||
)),
|
||||
]),
|
||||
));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user