From 69277dd16b840bf4c61fc1b47eee049f3a4be212 Mon Sep 17 00:00:00 2001 From: fufesou <13586388+fufesou@users.noreply.github.com> Date: Thu, 7 Nov 2024 14:58:10 +0800 Subject: [PATCH] fix: mobile, don't adjust canvas on gesture help show up (#9846) Signed-off-by: fufesou --- flutter/lib/models/model.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/flutter/lib/models/model.dart b/flutter/lib/models/model.dart index 2ddbcd22e..f68801f58 100644 --- a/flutter/lib/models/model.dart +++ b/flutter/lib/models/model.dart @@ -1475,14 +1475,16 @@ class CanvasModel with ChangeNotifier { if (isMobile) { h = h - mediaData.viewInsets.bottom - - (parent.target?.cursorModel.keyHelpToolsRect?.bottom ?? 0); + (parent.target?.cursorModel.keyHelpToolsRectToAdjustCanvas?.bottom ?? + 0); } return Size(w < 0 ? 0 : w, h < 0 ? 0 : h); } // mobile only double getAdjustY() { - final bottom = parent.target?.cursorModel.keyHelpToolsRect?.bottom ?? 0; + final bottom = + parent.target?.cursorModel.keyHelpToolsRectToAdjustCanvas?.bottom ?? 0; return max(bottom - MediaQueryData.fromView(ui.window).padding.top, 0); } @@ -1939,7 +1941,8 @@ class CursorModel with ChangeNotifier { bool _lastIsBlocked = false; bool _lastKeyboardIsVisible = false; - Rect? get keyHelpToolsRect => _keyHelpToolsRect; + Rect? get keyHelpToolsRectToAdjustCanvas => + _lastKeyboardIsVisible ? _keyHelpToolsRect : null; keyHelpToolsVisibilityChanged(Rect? r, bool keyboardIsVisible) { _keyHelpToolsRect = r; if (r == null) {