diff --git a/flutter/lib/common/widgets/overlay.dart b/flutter/lib/common/widgets/overlay.dart index c67f0f7fb..8c44e7ee4 100644 --- a/flutter/lib/common/widgets/overlay.dart +++ b/flutter/lib/common/widgets/overlay.dart @@ -388,6 +388,15 @@ class BlockableOverlayState extends OverlayKeyState { _middleBlocked.value = blocked; } } + + void applyFfi(FFI ffi) { + ffi.dialogManager.setOverlayState(this); + ffi.chatModel.setOverlayState(this); + // make remote page penetrable automatically, effective for chat over remote + onMiddleBlockedClick = () { + setMiddleBlocked(false); + }; + } } class BlockableOverlay extends StatelessWidget { diff --git a/flutter/lib/desktop/pages/remote_page.dart b/flutter/lib/desktop/pages/remote_page.dart index 3bc450345..312f9bbed 100644 --- a/flutter/lib/desktop/pages/remote_page.dart +++ b/flutter/lib/desktop/pages/remote_page.dart @@ -158,12 +158,7 @@ class _RemotePageState extends State // _isCustomCursorInited = true; // } - _ffi.dialogManager.setOverlayState(_blockableOverlayState); - _ffi.chatModel.setOverlayState(_blockableOverlayState); - // make remote page penetrable automatically, effective for chat over remote - _blockableOverlayState.onMiddleBlockedClick = () { - _blockableOverlayState.setMiddleBlocked(false); - }; + _blockableOverlayState.applyFfi(_ffi); } @override diff --git a/flutter/lib/mobile/pages/remote_page.dart b/flutter/lib/mobile/pages/remote_page.dart index 776aa5455..04852c98c 100644 --- a/flutter/lib/mobile/pages/remote_page.dart +++ b/flutter/lib/mobile/pages/remote_page.dart @@ -20,7 +20,6 @@ import '../../models/input_model.dart'; import '../../models/model.dart'; import '../../models/platform_model.dart'; import '../../utils/image.dart'; -import '../widgets/dialog.dart'; import '../widgets/gestures.dart'; final initText = '\1' * 1024; @@ -43,6 +42,8 @@ class _RemotePageState extends State { double _mouseScrollIntegral = 0; // mouse scroll speed controller Orientation? _currentOrientation; + final _blockableOverlayState = BlockableOverlayState(); + final keyboardVisibilityController = KeyboardVisibilityController(); late final StreamSubscription keyboardSubscription; final FocusNode _mobileFocusNode = FocusNode(); @@ -67,6 +68,7 @@ class _RemotePageState extends State { gFFI.qualityMonitorModel.checkShowQualityMonitor(widget.id); keyboardSubscription = keyboardVisibilityController.onChange.listen(onSoftKeyboardChanged); + _blockableOverlayState.applyFfi(gFFI); } @override