TF-1033: apply auto scroll to identity , composer , vacation screen

This commit is contained in:
ManhNTX
2022-10-06 09:15:27 +07:00
committed by Dat H. Pham
parent 5ba76f802b
commit a7c1d002d3
7 changed files with 58 additions and 5 deletions
@@ -66,6 +66,7 @@ class IdentityCreatorController extends BaseController {
String? _contentHtmlEditor;
final ScrollController scrollController = ScrollController();
double currentPositionYHTMLEditor = 250;
void updateNameIdentity(BuildContext context, String? value) {
_nameIdentity = value;
@@ -403,4 +404,20 @@ class IdentityCreatorController extends BaseController {
popBack();
}
}
void onFocusHTMLEditor() {
scrollController.animateTo(
currentPositionYHTMLEditor,
duration: const Duration(milliseconds: 300),
curve: Curves.linear,
);
}
void onEnterKeyDown() {
scrollController.animateTo(
currentPositionYHTMLEditor - keyboardRichTextController.currentLine * 20,
duration: const Duration(milliseconds: 300),
curve: Curves.linear,
);
}
}
@@ -510,12 +510,13 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
);
} else {
return html_editor_mobile.HtmlEditor(
key: const Key('signature_html_editor_mobile'),
key:const Key('html_editor_mobile'),
minHeight: 230,
onCreated: (htmlEditorController) {
controller.keyboardRichTextController.onCreateHTMLEditor(
htmlEditorController,
scrollController:controller.scrollController,
onFocus: controller.onFocusHTMLEditor,
onEnterKeyDown: controller.onEnterKeyDown,
);
controller.signatureHtmlEditorMobileController = htmlEditorController;
},