new keyboard offset and scroll

This commit is contained in:
open-trade
2020-12-21 17:26:23 +08:00
parent 0388e51299
commit 1acb64c35d
2 changed files with 17 additions and 6 deletions

View File

@@ -319,10 +319,12 @@ class CursorModel with ChangeNotifier {
}
double adjustForKeyboard() {
var keyboardHeight = MediaQueryData.fromWindow(ui.window).viewInsets.bottom;
final m = MediaQueryData.fromWindow(ui.window);
var keyboardHeight = m.viewInsets.bottom;
final size = m.size;
if (keyboardHeight < 100) return 0;
final s = FFI.canvasModel.scale;
final thresh = 120;
final thresh = (size.height - keyboardHeight) / 2;
var h = (_y - getVisibleRect().top) * s; // local physical display height
return h - thresh;
}