TF-2336 Fix jumping screen when clicking on Cc, Bcc

Signed-off-by: dab246 <tdvu@linagora.com>
(cherry picked from commit 376836017243e803ae056c085a2a0fb3756e2b15)
This commit is contained in:
dab246
2023-11-22 15:34:31 +07:00
committed by Dat H. Pham
parent 662a0f33f2
commit e0cf8272cf
6 changed files with 107 additions and 81 deletions
@@ -1699,18 +1699,12 @@ class ComposerController extends BaseController {
switch(prefixEmailAddress) {
case PrefixEmailAddress.to:
toAddressExpandMode.value = ExpandMode.EXPAND;
ccAddressExpandMode.value = ExpandMode.COLLAPSE;
bccAddressExpandMode.value = ExpandMode.COLLAPSE;
break;
case PrefixEmailAddress.cc:
ccAddressExpandMode.value = ExpandMode.EXPAND;
toAddressExpandMode.value = ExpandMode.COLLAPSE;
bccAddressExpandMode.value = ExpandMode.COLLAPSE;
break;
case PrefixEmailAddress.bcc:
bccAddressExpandMode.value = ExpandMode.EXPAND;
toAddressExpandMode.value = ExpandMode.COLLAPSE;
ccAddressExpandMode.value = ExpandMode.COLLAPSE;
break;
default:
break;
@@ -1720,9 +1714,30 @@ class ComposerController extends BaseController {
htmlEditorApi?.unfocus();
}
} else {
if (PlatformInfo.isMobile) {
_collapseAllRecipient();
_autoCreateEmailTag();
switch(prefixEmailAddress) {
case PrefixEmailAddress.to:
toAddressExpandMode.value = ExpandMode.COLLAPSE;
final inputToEmail = toEmailAddressController.text;
if (inputToEmail.isNotEmpty) {
_autoCreateToEmailTag(inputToEmail);
}
break;
case PrefixEmailAddress.cc:
ccAddressExpandMode.value = ExpandMode.COLLAPSE;
final inputCcEmail = ccEmailAddressController.text;
if (inputCcEmail.isNotEmpty) {
_autoCreateCcEmailTag(inputCcEmail);
}
break;
case PrefixEmailAddress.bcc:
bccAddressExpandMode.value = ExpandMode.COLLAPSE;
final inputBccEmail = bccEmailAddressController.text;
if (inputBccEmail.isNotEmpty) {
_autoCreateBccEmailTag(inputBccEmail);
}
break;
default:
break;
}
}
}
@@ -93,81 +93,92 @@ class ComposerView extends GetWidget<ComposerController> {
physics: const ClampingScrollPhysics(),
child: Column(
children: [
Obx(() => Column(
children: [
if (controller.fromRecipientState.value == PrefixRecipientState.enabled)
FromComposerMobileWidget(
selectedIdentity: controller.identitySelected.value,
imagePaths: controller.imagePaths,
responsiveUtils: controller.responsiveUtils,
margin: ComposerStyle.mobileRecipientMargin,
padding: ComposerStyle.mobileRecipientPadding,
onTap: () => controller.openSelectIdentityBottomSheet(context)
),
RecipientComposerWidget(
prefix: PrefixEmailAddress.to,
listEmailAddress: controller.listToEmailAddress,
fromState: controller.fromRecipientState.value,
ccState: controller.ccRecipientState.value,
bccState: controller.bccRecipientState.value,
expandMode: controller.toAddressExpandMode.value,
controller: controller.toEmailAddressController,
focusNode: controller.toAddressFocusNode,
keyTagEditor: controller.keyToEmailTagEditor,
Obx(() {
if (controller.fromRecipientState.value == PrefixRecipientState.enabled) {
return FromComposerMobileWidget(
selectedIdentity: controller.identitySelected.value,
imagePaths: controller.imagePaths,
responsiveUtils: controller.responsiveUtils,
margin: ComposerStyle.mobileRecipientMargin,
padding: ComposerStyle.mobileRecipientPadding,
onTap: () => controller.openSelectIdentityBottomSheet(context)
);
} else {
return const SizedBox.shrink();
}
}),
Obx(() => RecipientComposerWidget(
prefix: PrefixEmailAddress.to,
listEmailAddress: controller.listToEmailAddress,
fromState: controller.fromRecipientState.value,
ccState: controller.ccRecipientState.value,
bccState: controller.bccRecipientState.value,
expandMode: controller.toAddressExpandMode.value,
controller: controller.toEmailAddressController,
focusNode: controller.toAddressFocusNode,
keyTagEditor: controller.keyToEmailTagEditor,
isInitial: controller.isInitialRecipient.value,
padding: ComposerStyle.mobileRecipientPadding,
margin: ComposerStyle.mobileRecipientMargin,
nextFocusNode: controller.getNextFocusOfToEmailAddress(),
onFocusEmailAddressChangeAction: controller.onEmailAddressFocusChange,
onShowFullListEmailAddressAction: controller.showFullEmailAddress,
onAddEmailAddressTypeAction: controller.addEmailAddressType,
onUpdateListEmailAddressAction: controller.updateListEmailAddress,
onSuggestionEmailAddress: controller.getAutoCompleteSuggestion,
onFocusNextAddressAction: controller.handleFocusNextAddressAction,
onTapOutside: (_) => controller.onTapOutsideRecipients(PrefixEmailAddress.to),
)),
Obx(() {
if (controller.ccRecipientState.value == PrefixRecipientState.enabled) {
return RecipientComposerWidget(
prefix: PrefixEmailAddress.cc,
listEmailAddress: controller.listCcEmailAddress,
expandMode: controller.ccAddressExpandMode.value,
controller: controller.ccEmailAddressController,
focusNode: controller.ccAddressFocusNode,
keyTagEditor: controller.keyCcEmailTagEditor,
isInitial: controller.isInitialRecipient.value,
nextFocusNode: controller.getNextFocusOfCcEmailAddress(),
padding: ComposerStyle.mobileRecipientPadding,
margin: ComposerStyle.mobileRecipientMargin,
nextFocusNode: controller.getNextFocusOfToEmailAddress(),
onFocusEmailAddressChangeAction: controller.onEmailAddressFocusChange,
onShowFullListEmailAddressAction: controller.showFullEmailAddress,
onAddEmailAddressTypeAction: controller.addEmailAddressType,
onDeleteEmailAddressTypeAction: controller.deleteEmailAddressType,
onUpdateListEmailAddressAction: controller.updateListEmailAddress,
onSuggestionEmailAddress: controller.getAutoCompleteSuggestion,
onFocusNextAddressAction: controller.handleFocusNextAddressAction,
onTapOutside: (_) => controller.onTapOutsideRecipients(PrefixEmailAddress.to),
),
if (controller.ccRecipientState.value == PrefixRecipientState.enabled)
RecipientComposerWidget(
prefix: PrefixEmailAddress.cc,
listEmailAddress: controller.listCcEmailAddress,
expandMode: controller.ccAddressExpandMode.value,
controller: controller.ccEmailAddressController,
focusNode: controller.ccAddressFocusNode,
keyTagEditor: controller.keyCcEmailTagEditor,
isInitial: controller.isInitialRecipient.value,
nextFocusNode: controller.getNextFocusOfCcEmailAddress(),
padding: ComposerStyle.mobileRecipientPadding,
margin: ComposerStyle.mobileRecipientMargin,
onFocusEmailAddressChangeAction: controller.onEmailAddressFocusChange,
onShowFullListEmailAddressAction: controller.showFullEmailAddress,
onDeleteEmailAddressTypeAction: controller.deleteEmailAddressType,
onUpdateListEmailAddressAction: controller.updateListEmailAddress,
onSuggestionEmailAddress: controller.getAutoCompleteSuggestion,
onFocusNextAddressAction: controller.handleFocusNextAddressAction,
onTapOutside: (_) => controller.onTapOutsideRecipients(PrefixEmailAddress.cc),
),
if (controller.bccRecipientState.value == PrefixRecipientState.enabled)
RecipientComposerWidget(
prefix: PrefixEmailAddress.bcc,
listEmailAddress: controller.listBccEmailAddress,
expandMode: controller.bccAddressExpandMode.value,
controller: controller.bccEmailAddressController,
focusNode: controller.bccAddressFocusNode,
keyTagEditor: controller.keyBccEmailTagEditor,
isInitial: controller.isInitialRecipient.value,
nextFocusNode: controller.subjectEmailInputFocusNode,
padding: ComposerStyle.mobileRecipientPadding,
margin: ComposerStyle.mobileRecipientMargin,
onFocusEmailAddressChangeAction: controller.onEmailAddressFocusChange,
onShowFullListEmailAddressAction: controller.showFullEmailAddress,
onDeleteEmailAddressTypeAction: controller.deleteEmailAddressType,
onUpdateListEmailAddressAction: controller.updateListEmailAddress,
onSuggestionEmailAddress: controller.getAutoCompleteSuggestion,
onFocusNextAddressAction: controller.handleFocusNextAddressAction,
onTapOutside: (_) => controller.onTapOutsideRecipients(PrefixEmailAddress.bcc),
),
],
)),
onTapOutside: (_) => controller.onTapOutsideRecipients(PrefixEmailAddress.cc),
);
} else {
return const SizedBox.shrink();
}
}),
Obx(() {
if (controller.bccRecipientState.value == PrefixRecipientState.enabled) {
return RecipientComposerWidget(
prefix: PrefixEmailAddress.bcc,
listEmailAddress: controller.listBccEmailAddress,
expandMode: controller.bccAddressExpandMode.value,
controller: controller.bccEmailAddressController,
focusNode: controller.bccAddressFocusNode,
keyTagEditor: controller.keyBccEmailTagEditor,
isInitial: controller.isInitialRecipient.value,
nextFocusNode: controller.subjectEmailInputFocusNode,
padding: ComposerStyle.mobileRecipientPadding,
margin: ComposerStyle.mobileRecipientMargin,
onFocusEmailAddressChangeAction: controller.onEmailAddressFocusChange,
onShowFullListEmailAddressAction: controller.showFullEmailAddress,
onDeleteEmailAddressTypeAction: controller.deleteEmailAddressType,
onUpdateListEmailAddressAction: controller.updateListEmailAddress,
onSuggestionEmailAddress: controller.getAutoCompleteSuggestion,
onFocusNextAddressAction: controller.handleFocusNextAddressAction,
onTapOutside: (_) => controller.onTapOutsideRecipients(PrefixEmailAddress.bcc),
);
} else {
return const SizedBox.shrink();
}
}),
SubjectComposerWidget(
focusNode: controller.subjectEmailInputFocusNode,
textController: controller.subjectEmailInputController,
@@ -166,11 +166,11 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
keyboardType: TextInputType.emailAddress,
textInputAction: TextInputAction.done,
debounceDuration: RecipientComposerWidgetStyle.suggestionDebounceDuration,
hasAddButton: false,
tagSpacing: RecipientComposerWidgetStyle.tagSpacing,
autofocus: widget.prefix != PrefixEmailAddress.to && _currentListEmailAddress.isEmpty,
minTextFieldWidth: RecipientComposerWidgetStyle.minTextFieldWidth,
resetTextOnSubmitted: true,
autoScrollToInput: false,
suggestionsBoxElevation: RecipientComposerWidgetStyle.suggestionsBoxElevation,
suggestionsBoxBackgroundColor: RecipientComposerWidgetStyle.suggestionsBoxBackgroundColor,
suggestionsBoxRadius: RecipientComposerWidgetStyle.suggestionsBoxRadius,
@@ -240,11 +240,11 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
keyboardType: TextInputType.emailAddress,
textInputAction: TextInputAction.done,
debounceDuration: RecipientComposerWidgetStyle.suggestionDebounceDuration,
hasAddButton: false,
tagSpacing: RecipientComposerWidgetStyle.tagSpacing,
autofocus: widget.prefix != PrefixEmailAddress.to && _currentListEmailAddress.isEmpty,
minTextFieldWidth: RecipientComposerWidgetStyle.minTextFieldWidth,
resetTextOnSubmitted: true,
autoScrollToInput: false,
suggestionsBoxElevation: RecipientComposerWidgetStyle.suggestionsBoxElevation,
suggestionsBoxBackgroundColor: RecipientComposerWidgetStyle.suggestionsBoxBackgroundColor,
suggestionsBoxRadius: RecipientComposerWidgetStyle.suggestionsBoxRadius,
@@ -85,12 +85,12 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
suggestionMargin: const EdgeInsets.symmetric(vertical: 4),
keyboardType: TextInputType.emailAddress,
textInputAction: TextInputAction.done,
hasAddButton: false,
tagSpacing: PlatformInfo.isWeb ? 12 : 8,
autofocus: false,
minTextFieldWidth: 20,
debounceDuration: const Duration(milliseconds: 150),
resetTextOnSubmitted: true,
autoScrollToInput: false,
suggestionsBoxBackgroundColor: Colors.white,
suggestionsBoxRadius: 16,
suggestionsBoxMaxHeight: 350,
@@ -112,7 +112,6 @@ class _TextFieldAutocompleteEmailAddressWebState extends State<TextFieldAutocomp
keyboardType: TextInputType.emailAddress,
textInputAction: TextInputAction.done,
debounceDuration: TextFieldAutoCompleteEmailAddressWebStyles.debounceDuration,
hasAddButton: false,
inputDecoration: InputDecoration(
filled: true,
fillColor: TextFieldAutoCompleteEmailAddressWebStyles.textInputFillColor,
@@ -134,6 +133,7 @@ class _TextFieldAutocompleteEmailAddressWebState extends State<TextFieldAutocomp
enableBorderColor: AppColor.colorInputBorderCreateMailbox,
minTextFieldWidth: TextFieldAutoCompleteEmailAddressWebStyles.minTextFieldWidth,
resetTextOnSubmitted: true,
autoScrollToInput: false,
suggestionsBoxElevation: TextFieldAutoCompleteEmailAddressWebStyles.suggestionBoxElevation,
suggestionsBoxBackgroundColor: TextFieldAutoCompleteEmailAddressWebStyles.suggestionBoxBackgroundColor,
suggestionsBoxRadius: TextFieldAutoCompleteEmailAddressWebStyles.suggestionBoxRadius,
+1 -1
View File
@@ -1570,7 +1570,7 @@ packages:
description:
path: "."
ref: master
resolved-ref: aad6fb53c832fbe3b86f2b9eaefaab7a83392529
resolved-ref: dd81c8f1e870bacdffddda5b360c5fbe8a188bbb
url: "https://github.com/dab246/super_tag_editor.git"
source: git
version: "0.2.0"