TF-1033: replace hard code position by scrollController.position.pixels
This commit is contained in:
@@ -1366,12 +1366,13 @@ class ComposerController extends BaseController {
|
||||
popBack();
|
||||
}
|
||||
|
||||
|
||||
void onEnterKeyDown() {
|
||||
scrollController.animateTo(
|
||||
keyboardRichTextController.currentLine * 20,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.linear,
|
||||
);
|
||||
if(scrollController.position.pixels < scrollController.position.maxScrollExtent) {
|
||||
scrollController.animateTo(
|
||||
scrollController.position.pixels + 20,
|
||||
duration: const Duration(milliseconds: 1),
|
||||
curve: Curves.linear,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ class IdentityCreatorController extends BaseController {
|
||||
String? _contentHtmlEditor;
|
||||
|
||||
final ScrollController scrollController = ScrollController();
|
||||
double currentPositionYHTMLEditor = 250;
|
||||
final GlobalKey htmlKey = GlobalKey();
|
||||
|
||||
void updateNameIdentity(BuildContext context, String? value) {
|
||||
_nameIdentity = value;
|
||||
@@ -405,19 +405,24 @@ class IdentityCreatorController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
void onFocusHTMLEditor() {
|
||||
scrollController.animateTo(
|
||||
currentPositionYHTMLEditor,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.linear,
|
||||
);
|
||||
void onFocusHTMLEditor() async {
|
||||
await Scrollable.ensureVisible(htmlKey.currentContext!);
|
||||
await Future.delayed(const Duration(milliseconds: 500), () {
|
||||
scrollController.animateTo(
|
||||
scrollController.position.pixels + defaultKeyboardToolbarHeight,
|
||||
duration: const Duration(milliseconds: 1),
|
||||
curve: Curves.linear,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
void onEnterKeyDown() {
|
||||
scrollController.animateTo(
|
||||
currentPositionYHTMLEditor - keyboardRichTextController.currentLine * 20,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.linear,
|
||||
);
|
||||
if(scrollController.position.pixels < scrollController.position.maxScrollExtent) {
|
||||
scrollController.animateTo(
|
||||
scrollController.position.pixels + 20,
|
||||
duration: const Duration(milliseconds: 1),
|
||||
curve: Curves.linear,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -285,7 +285,6 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
child: SingleChildScrollView(
|
||||
controller: controller.scrollController,
|
||||
physics: const ClampingScrollPhysics(),
|
||||
reverse: true,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Column(children: [
|
||||
@@ -510,7 +509,7 @@ class IdentityCreatorView extends GetWidget<IdentityCreatorController> {
|
||||
);
|
||||
} else {
|
||||
return html_editor_mobile.HtmlEditor(
|
||||
key:const Key('html_editor_mobile'),
|
||||
key: controller.htmlKey,
|
||||
minHeight: 230,
|
||||
onCreated: (htmlEditorController) {
|
||||
controller.keyboardRichTextController.onCreateHTMLEditor(
|
||||
|
||||
@@ -44,6 +44,9 @@ class VacationController extends BaseController {
|
||||
final messageTextController = TextEditingController();
|
||||
final subjectTextController = TextEditingController();
|
||||
final richTextControllerForMobile = RichTextController();
|
||||
final htmlEditorMinHeight = 150;
|
||||
|
||||
final GlobalKey htmlKey = GlobalKey();
|
||||
|
||||
VacationResponse? currentVacation;
|
||||
String? _vacationMessageHtmlText;
|
||||
@@ -51,7 +54,6 @@ class VacationController extends BaseController {
|
||||
late Worker vacationWorker;
|
||||
|
||||
final ScrollController scrollController = ScrollController();
|
||||
double currentPositionYHTMLEditor = 660;
|
||||
|
||||
VacationController(
|
||||
this._getAllVacationInteractor,
|
||||
@@ -361,20 +363,25 @@ class VacationController extends BaseController {
|
||||
_settingController.backToUniversalSettings();
|
||||
}
|
||||
|
||||
void onFocusHTMLEditor() {
|
||||
scrollController.animateTo(
|
||||
currentPositionYHTMLEditor,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.linear,
|
||||
);
|
||||
void onFocusHTMLEditor() async {
|
||||
await Scrollable.ensureVisible(htmlKey.currentContext!);
|
||||
await Future.delayed(const Duration(milliseconds: 500), () {
|
||||
scrollController.animateTo(
|
||||
scrollController.position.pixels + defaultKeyboardToolbarHeight + htmlEditorMinHeight,
|
||||
duration: const Duration(milliseconds: 1),
|
||||
curve: Curves.linear,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
void onEnterKeyDown() {
|
||||
scrollController.animateTo(
|
||||
currentPositionYHTMLEditor + richTextControllerForMobile.currentLine * 20,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.linear,
|
||||
);
|
||||
if(scrollController.position.pixels < scrollController.position.maxScrollExtent) {
|
||||
scrollController.animateTo(
|
||||
scrollController.position.pixels + 20,
|
||||
duration: const Duration(milliseconds: 1),
|
||||
curve: Curves.linear,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -61,6 +61,7 @@ class VacationView extends GetWidget<VacationController> with RichTextButtonMixi
|
||||
: null,
|
||||
padding: SettingsUtils.getMarginViewForSettingDetails(context, _responsiveUtils),
|
||||
child: SingleChildScrollView(
|
||||
physics: const ClampingScrollPhysics(),
|
||||
controller: controller.scrollController,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -469,8 +470,8 @@ class VacationView extends GetWidget<VacationController> with RichTextButtonMixi
|
||||
);
|
||||
} else {
|
||||
return html_editor_mobile.HtmlEditor(
|
||||
key: const Key('vacation_message_html_text_editor_mobile'),
|
||||
minHeight: 150,
|
||||
key: controller.htmlKey,
|
||||
minHeight: controller.htmlEditorMinHeight,
|
||||
addDefaultSelectionMenuItems: false,
|
||||
initialContent: controller.vacationMessageHtmlText ?? '',
|
||||
onCreated: (htmlApi) {
|
||||
|
||||
+1
-1
@@ -1012,7 +1012,7 @@ packages:
|
||||
name: permission_handler_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.8.0"
|
||||
version: "3.9.0"
|
||||
permission_handler_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
Reference in New Issue
Block a user