TF-2671 Fix scroll jumping when typing on composer
(cherry picked from commit 2ab217d8b6193f61dfde0451ed49486cf51d664b)
This commit is contained in:
@@ -1651,7 +1651,7 @@ class ComposerController extends BaseController with DragDropFileMixin {
|
|||||||
if (coordinates?[1] != null && coordinates?[1] != 0) {
|
if (coordinates?[1] != null && coordinates?[1] != 0) {
|
||||||
final coordinateY = max((coordinates?[1] ?? 0) - defaultPaddingCoordinateYCursorEditor, 0);
|
final coordinateY = max((coordinates?[1] ?? 0) - defaultPaddingCoordinateYCursorEditor, 0);
|
||||||
final realCoordinateY = coordinateY + (headerEditorMobileSize?.height ?? 0);
|
final realCoordinateY = coordinateY + (headerEditorMobileSize?.height ?? 0);
|
||||||
final outsideHeight = Get.height - ComposerStyle.keyboardMaxHeight - ComposerStyle.keyboardToolBarHeight;
|
final outsideHeight = Get.height - MediaQuery.viewInsetsOf(context).bottom - ComposerStyle.keyboardToolBarHeight;
|
||||||
final webViewEditorClientY = max(outsideHeight, 0) + scrollController.position.pixels;
|
final webViewEditorClientY = max(outsideHeight, 0) + scrollController.position.pixels;
|
||||||
if (scrollController.position.pixels >= realCoordinateY) {
|
if (scrollController.position.pixels >= realCoordinateY) {
|
||||||
_scrollToCursorEditor(
|
_scrollToCursorEditor(
|
||||||
@@ -1675,9 +1675,12 @@ class ComposerController extends BaseController with DragDropFileMixin {
|
|||||||
double headerEditorMobileHeight,
|
double headerEditorMobileHeight,
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
) {
|
) {
|
||||||
scrollController.jumpTo(
|
final scrollTarget = realCoordinateY -
|
||||||
realCoordinateY - (responsiveUtils.isLandscapeMobile(context) ? 0 : headerEditorMobileHeight / 2),
|
(responsiveUtils.isLandscapeMobile(context)
|
||||||
);
|
? 0
|
||||||
|
: headerEditorMobileHeight / 2);
|
||||||
|
final maxScrollExtend = scrollController.position.maxScrollExtent;
|
||||||
|
scrollController.jumpTo(min(scrollTarget, maxScrollExtend));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onEnterKeyDown() {
|
void _onEnterKeyDown() {
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ class ComposerView extends GetWidget<ComposerController> {
|
|||||||
onLoadCompletedEditorAction: controller.onLoadCompletedMobileEditorAction,
|
onLoadCompletedEditorAction: controller.onLoadCompletedMobileEditorAction,
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
const SizedBox(height: ComposerStyle.keyboardMaxHeight),
|
SizedBox(height: MediaQuery.viewInsetsOf(context).bottom),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
class ComposerStyle {
|
class ComposerStyle {
|
||||||
static const double radius = 28;
|
static const double radius = 28;
|
||||||
static const double keyboardMaxHeight = 500;
|
|
||||||
static const double keyboardToolBarHeight = 200;
|
static const double keyboardToolBarHeight = 200;
|
||||||
static const double popupMenuRadius = 8;
|
static const double popupMenuRadius = 8;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -429,7 +429,7 @@ packages:
|
|||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: cnb_supported
|
ref: cnb_supported
|
||||||
resolved-ref: "669cfd989498cf398c88a6618eebb089967b9e28"
|
resolved-ref: "69996e32a708a62b8a613f2524c5635f5c556617"
|
||||||
url: "https://github.com/linagora/enough_html_editor.git"
|
url: "https://github.com/linagora/enough_html_editor.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.5"
|
version: "0.0.5"
|
||||||
|
|||||||
Reference in New Issue
Block a user