flutter: keep chat window within screen bounds to prevent hidden chat window (fixes rustdesk#13397) (#13406)
This commit is contained in:
@@ -50,6 +50,7 @@ class DraggableChatWindow extends StatelessWidget {
|
|||||||
)
|
)
|
||||||
: Draggable(
|
: Draggable(
|
||||||
checkKeyboard: true,
|
checkKeyboard: true,
|
||||||
|
checkScreenSize: true,
|
||||||
position: draggablePositions.chatWindow,
|
position: draggablePositions.chatWindow,
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
@@ -395,7 +396,10 @@ class _DraggableState extends State<Draggable> {
|
|||||||
_chatModel?.setChatWindowPosition(position);
|
_chatModel?.setChatWindowPosition(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkScreenSize() {}
|
checkScreenSize() {
|
||||||
|
// Ensure the draggable always stays within current screen bounds
|
||||||
|
widget.position.tryAdjust(widget.width, widget.height, 1);
|
||||||
|
}
|
||||||
|
|
||||||
checkKeyboard() {
|
checkKeyboard() {
|
||||||
final bottomHeight = MediaQuery.of(context).viewInsets.bottom;
|
final bottomHeight = MediaQuery.of(context).viewInsets.bottom;
|
||||||
@@ -517,6 +521,12 @@ class IOSDraggableState extends State<IOSDraggable> {
|
|||||||
_lastBottomHeight = bottomHeight;
|
_lastBottomHeight = bottomHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
position.tryAdjust(_width, _height, 1);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
checkKeyboard();
|
checkKeyboard();
|
||||||
|
|||||||
Reference in New Issue
Block a user