TF-1573: add removeFocusAllInputEditorHeader function

(cherry picked from commit f6ba2c7565f41dc58b354917c85efb98ff4aae24)
This commit is contained in:
ManhNTX
2023-03-17 13:08:44 +07:00
committed by Dat Vu
parent 1887a810e5
commit 7e580a3c0e
2 changed files with 10 additions and 11 deletions
@@ -1516,18 +1516,17 @@ class ComposerController extends BaseController {
if (Platform.isAndroid) { if (Platform.isAndroid) {
_collapseAllRecipient(); _collapseAllRecipient();
_autoCreateEmailTag(); _autoCreateEmailTag();
_removeFocusAllInputEditorHeader();
} }
} }
void _removeFocusAllInputEditorHeader() { void removeFocusAllInputEditorHeader() {
subjectEmailInputFocusNode?.unfocus(); subjectEmailInputFocusNode?.unfocus();
toAddressFocusNode?.unfocus(); toAddressFocusNode?.unfocus();
ccAddressFocusNode?.unfocus(); ccAddressFocusNode?.unfocus();
bccAddressFocusNode?.unfocus(); bccAddressFocusNode?.unfocus();
} }
void _onChangeCursorOnMobile(List<int>? coordinates) {
void _onChangeCursorOnMobile(List<int>? coordinates) {
final headerEditorMobileWidgetRenderObject = headerEditorMobileWidgetKey.currentContext?.findRenderObject(); final headerEditorMobileWidgetRenderObject = headerEditorMobileWidgetKey.currentContext?.findRenderObject();
if (headerEditorMobileWidgetRenderObject is RenderBox?) { if (headerEditorMobileWidgetRenderObject is RenderBox?) {
@@ -631,7 +631,7 @@ class ComposerView extends GetWidget<ComposerController>
Widget _buildHtmlEditor(BuildContext context, {String? initialContent}) { Widget _buildHtmlEditor(BuildContext context, {String? initialContent}) {
return GestureDetector( return GestureDetector(
onTapDown: (_) { onTapDown: (_) {
FocusManager.instance.primaryFocus?.unfocus(); controller.removeFocusAllInputEditorHeader();
}, },
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 20), padding: const EdgeInsets.only(left: 16, right: 16, bottom: 20),
@@ -640,7 +640,7 @@ class ComposerView extends GetWidget<ComposerController>
minHeight: 550, minHeight: 550,
addDefaultSelectionMenuItems: false, addDefaultSelectionMenuItems: false,
initialContent: initialContent ?? '', initialContent: initialContent ?? '',
onCreated: (editorApi) => controller.initRichTextForMobile(context, editorApi) onCreated: (editorApi) => controller.initRichTextForMobile(context, editorApi, initialContent)
), ),
), ),
); );