fix: mobile, don't adjust canvas on gesture help show up (#9846)

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou 2024-11-07 14:58:10 +08:00 committed by GitHub
parent faf97c770c
commit 69277dd16b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1475,14 +1475,16 @@ class CanvasModel with ChangeNotifier {
if (isMobile) { if (isMobile) {
h = h - h = h -
mediaData.viewInsets.bottom - 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); return Size(w < 0 ? 0 : w, h < 0 ? 0 : h);
} }
// mobile only // mobile only
double getAdjustY() { 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); return max(bottom - MediaQueryData.fromView(ui.window).padding.top, 0);
} }
@ -1939,7 +1941,8 @@ class CursorModel with ChangeNotifier {
bool _lastIsBlocked = false; bool _lastIsBlocked = false;
bool _lastKeyboardIsVisible = false; bool _lastKeyboardIsVisible = false;
Rect? get keyHelpToolsRect => _keyHelpToolsRect; Rect? get keyHelpToolsRectToAdjustCanvas =>
_lastKeyboardIsVisible ? _keyHelpToolsRect : null;
keyHelpToolsVisibilityChanged(Rect? r, bool keyboardIsVisible) { keyHelpToolsVisibilityChanged(Rect? r, bool keyboardIsVisible) {
_keyHelpToolsRect = r; _keyHelpToolsRect = r;
if (r == null) { if (r == null) {