TF-1573: scroll to cursor in Landscape mode
(cherry picked from commit fc1edb4be8c833e49c33468c48db8d0d325d243c)
This commit is contained in:
@@ -360,7 +360,9 @@ class ComposerController extends BaseController {
|
|||||||
onEnterKeyDown: _onEnterKeyDown,
|
onEnterKeyDown: _onEnterKeyDown,
|
||||||
context: context,
|
context: context,
|
||||||
onFocus: _onEditorFocusOnMobile,
|
onFocus: _onEditorFocusOnMobile,
|
||||||
onChangeCursor: _onChangeCursorOnMobile,
|
onChangeCursor: (coordinates) {
|
||||||
|
_onChangeCursorOnMobile(coordinates, context);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1527,7 +1529,7 @@ class ComposerController extends BaseController {
|
|||||||
bccAddressFocusNode?.unfocus();
|
bccAddressFocusNode?.unfocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onChangeCursorOnMobile(List<int>? coordinates) {
|
void _onChangeCursorOnMobile(List<int>? coordinates, BuildContext context) {
|
||||||
final headerEditorMobileWidgetRenderObject = headerEditorMobileWidgetKey.currentContext?.findRenderObject();
|
final headerEditorMobileWidgetRenderObject = headerEditorMobileWidgetKey.currentContext?.findRenderObject();
|
||||||
if (headerEditorMobileWidgetRenderObject is RenderBox?) {
|
if (headerEditorMobileWidgetRenderObject is RenderBox?) {
|
||||||
final headerEditorMobileSize = headerEditorMobileWidgetRenderObject?.size;
|
final headerEditorMobileSize = headerEditorMobileWidgetRenderObject?.size;
|
||||||
@@ -1536,20 +1538,32 @@ class ComposerController extends BaseController {
|
|||||||
final realCoordinateY = coordinateY + (headerEditorMobileSize?.height ?? 0);
|
final realCoordinateY = coordinateY + (headerEditorMobileSize?.height ?? 0);
|
||||||
final webViewEditorClientY = max(Get.height - maxKeyBoardHeight - richTextBarHeight, 0) + scrollController.position.pixels;
|
final webViewEditorClientY = max(Get.height - maxKeyBoardHeight - richTextBarHeight, 0) + scrollController.position.pixels;
|
||||||
if (scrollController.position.pixels >= realCoordinateY) {
|
if (scrollController.position.pixels >= realCoordinateY) {
|
||||||
scrollController.jumpTo(
|
_scrollToCursorEditor(
|
||||||
realCoordinateY.toDouble() - (headerEditorMobileSize?.height ?? 0) / 2,
|
realCoordinateY.toDouble(),
|
||||||
|
headerEditorMobileSize?.height ?? 0,
|
||||||
|
context,
|
||||||
);
|
);
|
||||||
}
|
} else if ((realCoordinateY) >= webViewEditorClientY) {
|
||||||
|
_scrollToCursorEditor(
|
||||||
if ((realCoordinateY) >= webViewEditorClientY) {
|
realCoordinateY.toDouble(),
|
||||||
scrollController.jumpTo(
|
headerEditorMobileSize?.height ?? 0,
|
||||||
realCoordinateY.toDouble() - (headerEditorMobileSize?.height ?? 0) / 2,
|
context,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _scrollToCursorEditor(
|
||||||
|
double realCoordinateY,
|
||||||
|
double headerEditorMobileHeight,
|
||||||
|
BuildContext context,
|
||||||
|
) {
|
||||||
|
scrollController.jumpTo(
|
||||||
|
realCoordinateY - (_responsiveUtils.isLandscapeMobile(context) ? 0 : headerEditorMobileHeight / 2),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void _onEnterKeyDown() {
|
void _onEnterKeyDown() {
|
||||||
if(scrollController.position.pixels < scrollController.position.maxScrollExtent) {
|
if(scrollController.position.pixels < scrollController.position.maxScrollExtent) {
|
||||||
scrollController.animateTo(
|
scrollController.animateTo(
|
||||||
|
|||||||
Reference in New Issue
Block a user