Merge pull request #6184 from fufesou/fix/dialog_block_tab_on_remote_page

fix, dialog blocks tabs on the remote page
This commit is contained in:
RustDesk 2023-10-26 16:57:17 +08:00 committed by GitHub
commit 9736a4ddd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 7 deletions

View File

@ -80,7 +80,7 @@ class _RemotePageState extends State<RemotePage>
late RxBool _keyboardEnabled;
final Map<int, RenderTexture> _renderTextures = {};
final _blockableOverlayState = BlockableOverlayState();
var _blockableOverlayState = BlockableOverlayState();
final FocusNode _rawKeyFocusNode = FocusNode(debugLabel: "rawkeyFocusNode");
@ -253,9 +253,9 @@ class _RemotePageState extends State<RemotePage>
onEnterOrLeaveImageCleaner: () => _onEnterOrLeaveImage4Toolbar = null,
setRemoteState: setState,
);
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.background,
body: Stack(
bodyWidget() {
return Stack(
children: [
Container(
color: Colors.black,
@ -281,7 +281,7 @@ class _RemotePageState extends State<RemotePage>
},
inputModel: _ffi.inputModel,
child: getBodyForDesktop(context))),
Obx(() => Stack(
Stack(
children: [
_ffi.ffiModel.pi.isSet.isTrue &&
_ffi.ffiModel.waitForFirstImage.isTrue
@ -298,9 +298,34 @@ class _RemotePageState extends State<RemotePage>
: remoteToolbar(context),
_ffi.ffiModel.pi.isSet.isFalse ? emptyOverlay() : Offstage(),
],
)),
),
],
),
);
}
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.background,
body: Obx(() {
final imageReady = _ffi.ffiModel.pi.isSet.isTrue &&
_ffi.ffiModel.waitForFirstImage.isFalse;
if (imageReady) {
// dismissAll() is ensure the state is clean.
// It's ok to call dismissAll() here.
_ffi.dialogManager.dismissAll();
// Recreate the block state to refresh the state.
_blockableOverlayState = BlockableOverlayState();
_blockableOverlayState.applyFfi(_ffi);
// Block the whole bodyWidget() when dialog shows.
return BlockableOverlay(
underlying: bodyWidget(),
state: _blockableOverlayState,
);
} else {
// _blockableOverlayState is not recreated here.
// The block state for the toolbar will not work on reconnecting, but it's ok.
return bodyWidget();
}
}),
);
}

View File

@ -210,6 +210,7 @@ pub fn session_reconnect(session_id: SessionID, force_relay: bool) {
if let Some(session) = sessions::get_session_by_session_id(&session_id) {
session.reconnect(force_relay);
}
session_on_waiting_for_image_dialog_show(session_id);
}
pub fn session_toggle_option(session_id: SessionID, value: String) {