mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-06 06:31:29 +03:00
refactor OverlayKeyState for OverlayDialogManager and ChatModel
This commit is contained in:
@@ -80,6 +80,7 @@ class _FileManagerPageState extends State<FileManagerPage>
|
||||
Entry? _lastClickEntry;
|
||||
|
||||
final _dropMaskVisible = false.obs; // TODO impl drop mask
|
||||
final _overlayKeyState = OverlayKeyState();
|
||||
|
||||
ScrollController getBreadCrumbScrollController(bool isLocal) {
|
||||
return isLocal ? _breadCrumbScrollerLocal : _breadCrumbScrollerRemote;
|
||||
@@ -115,6 +116,7 @@ class _FileManagerPageState extends State<FileManagerPage>
|
||||
// register location listener
|
||||
_locationNodeLocal.addListener(onLocalLocationFocusChanged);
|
||||
_locationNodeRemote.addListener(onRemoteLocationFocusChanged);
|
||||
_ffi.dialogManager.setOverlayState(_overlayKeyState);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -137,9 +139,8 @@ class _FileManagerPageState extends State<FileManagerPage>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return Overlay(initialEntries: [
|
||||
OverlayEntry(builder: (context) {
|
||||
_ffi.dialogManager.setOverlayState(Overlay.of(context));
|
||||
return Overlay(key: _overlayKeyState.key, initialEntries: [
|
||||
OverlayEntry(builder: (_) {
|
||||
return ChangeNotifierProvider.value(
|
||||
value: _ffi.fileModel,
|
||||
child: Consumer<FileModel>(builder: (context, model, child) {
|
||||
|
||||
@@ -62,7 +62,7 @@ class _RemotePageState extends State<RemotePage>
|
||||
late RxBool _remoteCursorMoved;
|
||||
late RxBool _keyboardEnabled;
|
||||
|
||||
final overlayState = PenetrableOverlayState();
|
||||
final _blockableOverlayState = BlockableOverlayState();
|
||||
|
||||
final FocusNode _rawKeyFocusNode = FocusNode(debugLabel: "rawkeyFocusNode");
|
||||
|
||||
@@ -136,10 +136,11 @@ class _RemotePageState extends State<RemotePage>
|
||||
// _isCustomCursorInited = true;
|
||||
// }
|
||||
|
||||
_ffi.chatModel.setPenetrableOverlayState(overlayState);
|
||||
_ffi.dialogManager.setOverlayState(_blockableOverlayState);
|
||||
_ffi.chatModel.setOverlayState(_blockableOverlayState);
|
||||
// make remote page penetrable automatically, effective for chat over remote
|
||||
overlayState.onMiddleBlockedClick = () {
|
||||
overlayState.setMiddleBlocked(false);
|
||||
_blockableOverlayState.onMiddleBlockedClick = () {
|
||||
_blockableOverlayState.setMiddleBlocked(false);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -201,8 +202,11 @@ class _RemotePageState extends State<RemotePage>
|
||||
Widget buildBody(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).backgroundColor,
|
||||
body: PenetrableOverlay(
|
||||
state: overlayState,
|
||||
|
||||
/// the Overlay key will be set with _blockableOverlayState in BlockableOverlay
|
||||
/// see override build() in [BlockableOverlay]
|
||||
body: BlockableOverlay(
|
||||
state: _blockableOverlayState,
|
||||
underlying: Container(
|
||||
color: Colors.black,
|
||||
child: RawKeyFocusScope(
|
||||
|
||||
Reference in New Issue
Block a user