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:
21pages
2024-07-08 20:08:05 +08:00
committed by GitHub
parent eb5ab4d7d9
commit af66d2a73b
4 changed files with 162 additions and 135 deletions

View File

@@ -116,22 +116,14 @@ class _DesktopTabPageState extends State<DesktopTabPage>
isClose: false,
),
),
blockTab: _block,
)));
widget() => MouseRegion(
onEnter: (_) async {
// mouseIn = true;
await shouldBeBlocked(_block, canBeBlocked);
},
onExit: (_) {
// mouseIn = false;
},
child: FocusScope(child: tabWidget, canRequestFocus: !_block.value));
return isMacOS || kUseCompatibleUiMode
? Obx(() => widget())
? Obx(() => tabWidget)
: Obx(
() => DragToResizeArea(
resizeEdgeSize: stateGlobal.resizeEdgeSize.value,
child: widget(),
child: tabWidget,
),
);
}

View File

@@ -104,7 +104,18 @@ class ConnectionManager extends StatefulWidget {
State<StatefulWidget> createState() => ConnectionManagerState();
}
class ConnectionManagerState extends State<ConnectionManager> {
class ConnectionManagerState extends State<ConnectionManager>
with WidgetsBindingObserver {
final RxBool _block = false.obs;
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
super.didChangeAppLifecycleState(state);
if (state == AppLifecycleState.resumed) {
shouldBeBlocked(_block, null);
}
}
@override
void initState() {
gFFI.serverModel.updateClientState();
@@ -127,9 +138,16 @@ class ConnectionManagerState extends State<ConnectionManager> {
}
};
gFFI.chatModel.isConnManager = true;
WidgetsBinding.instance.addObserver(this);
super.initState();
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
@override
Widget build(BuildContext context) {
final serverModel = Provider.of<ServerModel>(context);
@@ -165,6 +183,7 @@ class ConnectionManagerState extends State<ConnectionManager> {
selectedBorderColor: MyTheme.accent,
maxLabelWidth: 100,
tail: null, //buildScrollJumper(),
blockTab: _block,
selectedTabBackgroundColor:
Theme.of(context).hintColor.withOpacity(0),
tabBuilder: (key, icon, label, themeConf) {
@@ -208,14 +227,9 @@ class ConnectionManagerState extends State<ConnectionManager> {
builder: (_, model, child) => SizedBox(
width: realChatPageWidth,
child: buildRemoteBlock(
child: Container(
decoration: BoxDecoration(
border: Border(
right: BorderSide(
color: Theme.of(context)
.dividerColor))),
child: buildSidePage()),
),
child: buildSidePage(),
block: _block,
mask: true),
)),
SizedBox(
width: realClosedWidth,