From b75f4daa47bd8899549d15a22defe65bdfc28d6f Mon Sep 17 00:00:00 2001 From: 21pages Date: Tue, 4 Nov 2025 09:44:13 +0800 Subject: [PATCH] flutter: keep chat window within screen bounds to prevent hidden chat window (fixes rustdesk#13397) (#13406) --- flutter/lib/common/widgets/overlay.dart | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/flutter/lib/common/widgets/overlay.dart b/flutter/lib/common/widgets/overlay.dart index 9b20136e1..3fb63616d 100644 --- a/flutter/lib/common/widgets/overlay.dart +++ b/flutter/lib/common/widgets/overlay.dart @@ -50,6 +50,7 @@ class DraggableChatWindow extends StatelessWidget { ) : Draggable( checkKeyboard: true, + checkScreenSize: true, position: draggablePositions.chatWindow, width: width, height: height, @@ -395,7 +396,10 @@ class _DraggableState extends State { _chatModel?.setChatWindowPosition(position); } - checkScreenSize() {} + checkScreenSize() { + // Ensure the draggable always stays within current screen bounds + widget.position.tryAdjust(widget.width, widget.height, 1); + } checkKeyboard() { final bottomHeight = MediaQuery.of(context).viewInsets.bottom; @@ -517,6 +521,12 @@ class IOSDraggableState extends State { _lastBottomHeight = bottomHeight; } + @override + void initState() { + super.initState(); + position.tryAdjust(_width, _height, 1); + } + @override Widget build(BuildContext context) { checkKeyboard();