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) { switch(prefixEmailAddress) {
case PrefixEmailAddress.to: case PrefixEmailAddress.to:
toAddressExpandMode.value = ExpandMode.EXPAND; toAddressExpandMode.value = ExpandMode.EXPAND;
ccAddressExpandMode.value = ExpandMode.COLLAPSE;
bccAddressExpandMode.value = ExpandMode.COLLAPSE;
break; break;
case PrefixEmailAddress.cc: case PrefixEmailAddress.cc:
ccAddressExpandMode.value = ExpandMode.EXPAND; ccAddressExpandMode.value = ExpandMode.EXPAND;
toAddressExpandMode.value = ExpandMode.COLLAPSE;
bccAddressExpandMode.value = ExpandMode.COLLAPSE;
break; break;
case PrefixEmailAddress.bcc: case PrefixEmailAddress.bcc:
bccAddressExpandMode.value = ExpandMode.EXPAND; bccAddressExpandMode.value = ExpandMode.EXPAND;
toAddressExpandMode.value = ExpandMode.COLLAPSE;
ccAddressExpandMode.value = ExpandMode.COLLAPSE;
break; break;
default: default:
break; break;
@@ -1720,9 +1714,30 @@ class ComposerController extends BaseController {
htmlEditorApi?.unfocus(); htmlEditorApi?.unfocus();
} }
} else { } else {
if (PlatformInfo.isMobile) { switch(prefixEmailAddress) {
_collapseAllRecipient(); case PrefixEmailAddress.to:
_autoCreateEmailTag(); 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(), physics: const ClampingScrollPhysics(),
child: Column( child: Column(
children: [ children: [
Obx(() => Column( Obx(() {
children: [ if (controller.fromRecipientState.value == PrefixRecipientState.enabled) {
if (controller.fromRecipientState.value == PrefixRecipientState.enabled) return FromComposerMobileWidget(
FromComposerMobileWidget( selectedIdentity: controller.identitySelected.value,
selectedIdentity: controller.identitySelected.value, imagePaths: controller.imagePaths,
imagePaths: controller.imagePaths, responsiveUtils: controller.responsiveUtils,
responsiveUtils: controller.responsiveUtils, margin: ComposerStyle.mobileRecipientMargin,
margin: ComposerStyle.mobileRecipientMargin, padding: ComposerStyle.mobileRecipientPadding,
padding: ComposerStyle.mobileRecipientPadding, onTap: () => controller.openSelectIdentityBottomSheet(context)
onTap: () => controller.openSelectIdentityBottomSheet(context) );
), } else {
RecipientComposerWidget( return const SizedBox.shrink();
prefix: PrefixEmailAddress.to, }
listEmailAddress: controller.listToEmailAddress, }),
fromState: controller.fromRecipientState.value, Obx(() => RecipientComposerWidget(
ccState: controller.ccRecipientState.value, prefix: PrefixEmailAddress.to,
bccState: controller.bccRecipientState.value, listEmailAddress: controller.listToEmailAddress,
expandMode: controller.toAddressExpandMode.value, fromState: controller.fromRecipientState.value,
controller: controller.toEmailAddressController, ccState: controller.ccRecipientState.value,
focusNode: controller.toAddressFocusNode, bccState: controller.bccRecipientState.value,
keyTagEditor: controller.keyToEmailTagEditor, 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, isInitial: controller.isInitialRecipient.value,
nextFocusNode: controller.getNextFocusOfCcEmailAddress(),
padding: ComposerStyle.mobileRecipientPadding, padding: ComposerStyle.mobileRecipientPadding,
margin: ComposerStyle.mobileRecipientMargin, margin: ComposerStyle.mobileRecipientMargin,
nextFocusNode: controller.getNextFocusOfToEmailAddress(),
onFocusEmailAddressChangeAction: controller.onEmailAddressFocusChange, onFocusEmailAddressChangeAction: controller.onEmailAddressFocusChange,
onShowFullListEmailAddressAction: controller.showFullEmailAddress, onShowFullListEmailAddressAction: controller.showFullEmailAddress,
onAddEmailAddressTypeAction: controller.addEmailAddressType, onDeleteEmailAddressTypeAction: controller.deleteEmailAddressType,
onUpdateListEmailAddressAction: controller.updateListEmailAddress, onUpdateListEmailAddressAction: controller.updateListEmailAddress,
onSuggestionEmailAddress: controller.getAutoCompleteSuggestion, onSuggestionEmailAddress: controller.getAutoCompleteSuggestion,
onFocusNextAddressAction: controller.handleFocusNextAddressAction, onFocusNextAddressAction: controller.handleFocusNextAddressAction,
onTapOutside: (_) => controller.onTapOutsideRecipients(PrefixEmailAddress.to), onTapOutside: (_) => controller.onTapOutsideRecipients(PrefixEmailAddress.cc),
), );
if (controller.ccRecipientState.value == PrefixRecipientState.enabled) } else {
RecipientComposerWidget( return const SizedBox.shrink();
prefix: PrefixEmailAddress.cc, }
listEmailAddress: controller.listCcEmailAddress, }),
expandMode: controller.ccAddressExpandMode.value, Obx(() {
controller: controller.ccEmailAddressController, if (controller.bccRecipientState.value == PrefixRecipientState.enabled) {
focusNode: controller.ccAddressFocusNode, return RecipientComposerWidget(
keyTagEditor: controller.keyCcEmailTagEditor, prefix: PrefixEmailAddress.bcc,
isInitial: controller.isInitialRecipient.value, listEmailAddress: controller.listBccEmailAddress,
nextFocusNode: controller.getNextFocusOfCcEmailAddress(), expandMode: controller.bccAddressExpandMode.value,
padding: ComposerStyle.mobileRecipientPadding, controller: controller.bccEmailAddressController,
margin: ComposerStyle.mobileRecipientMargin, focusNode: controller.bccAddressFocusNode,
onFocusEmailAddressChangeAction: controller.onEmailAddressFocusChange, keyTagEditor: controller.keyBccEmailTagEditor,
onShowFullListEmailAddressAction: controller.showFullEmailAddress, isInitial: controller.isInitialRecipient.value,
onDeleteEmailAddressTypeAction: controller.deleteEmailAddressType, nextFocusNode: controller.subjectEmailInputFocusNode,
onUpdateListEmailAddressAction: controller.updateListEmailAddress, padding: ComposerStyle.mobileRecipientPadding,
onSuggestionEmailAddress: controller.getAutoCompleteSuggestion, margin: ComposerStyle.mobileRecipientMargin,
onFocusNextAddressAction: controller.handleFocusNextAddressAction, onFocusEmailAddressChangeAction: controller.onEmailAddressFocusChange,
onTapOutside: (_) => controller.onTapOutsideRecipients(PrefixEmailAddress.cc), onShowFullListEmailAddressAction: controller.showFullEmailAddress,
), onDeleteEmailAddressTypeAction: controller.deleteEmailAddressType,
if (controller.bccRecipientState.value == PrefixRecipientState.enabled) onUpdateListEmailAddressAction: controller.updateListEmailAddress,
RecipientComposerWidget( onSuggestionEmailAddress: controller.getAutoCompleteSuggestion,
prefix: PrefixEmailAddress.bcc, onFocusNextAddressAction: controller.handleFocusNextAddressAction,
listEmailAddress: controller.listBccEmailAddress, onTapOutside: (_) => controller.onTapOutsideRecipients(PrefixEmailAddress.bcc),
expandMode: controller.bccAddressExpandMode.value, );
controller: controller.bccEmailAddressController, } else {
focusNode: controller.bccAddressFocusNode, return const SizedBox.shrink();
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),
),
],
)),
SubjectComposerWidget( SubjectComposerWidget(
focusNode: controller.subjectEmailInputFocusNode, focusNode: controller.subjectEmailInputFocusNode,
textController: controller.subjectEmailInputController, textController: controller.subjectEmailInputController,
@@ -166,11 +166,11 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
textInputAction: TextInputAction.done, textInputAction: TextInputAction.done,
debounceDuration: RecipientComposerWidgetStyle.suggestionDebounceDuration, debounceDuration: RecipientComposerWidgetStyle.suggestionDebounceDuration,
hasAddButton: false,
tagSpacing: RecipientComposerWidgetStyle.tagSpacing, tagSpacing: RecipientComposerWidgetStyle.tagSpacing,
autofocus: widget.prefix != PrefixEmailAddress.to && _currentListEmailAddress.isEmpty, autofocus: widget.prefix != PrefixEmailAddress.to && _currentListEmailAddress.isEmpty,
minTextFieldWidth: RecipientComposerWidgetStyle.minTextFieldWidth, minTextFieldWidth: RecipientComposerWidgetStyle.minTextFieldWidth,
resetTextOnSubmitted: true, resetTextOnSubmitted: true,
autoScrollToInput: false,
suggestionsBoxElevation: RecipientComposerWidgetStyle.suggestionsBoxElevation, suggestionsBoxElevation: RecipientComposerWidgetStyle.suggestionsBoxElevation,
suggestionsBoxBackgroundColor: RecipientComposerWidgetStyle.suggestionsBoxBackgroundColor, suggestionsBoxBackgroundColor: RecipientComposerWidgetStyle.suggestionsBoxBackgroundColor,
suggestionsBoxRadius: RecipientComposerWidgetStyle.suggestionsBoxRadius, suggestionsBoxRadius: RecipientComposerWidgetStyle.suggestionsBoxRadius,
@@ -240,11 +240,11 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
textInputAction: TextInputAction.done, textInputAction: TextInputAction.done,
debounceDuration: RecipientComposerWidgetStyle.suggestionDebounceDuration, debounceDuration: RecipientComposerWidgetStyle.suggestionDebounceDuration,
hasAddButton: false,
tagSpacing: RecipientComposerWidgetStyle.tagSpacing, tagSpacing: RecipientComposerWidgetStyle.tagSpacing,
autofocus: widget.prefix != PrefixEmailAddress.to && _currentListEmailAddress.isEmpty, autofocus: widget.prefix != PrefixEmailAddress.to && _currentListEmailAddress.isEmpty,
minTextFieldWidth: RecipientComposerWidgetStyle.minTextFieldWidth, minTextFieldWidth: RecipientComposerWidgetStyle.minTextFieldWidth,
resetTextOnSubmitted: true, resetTextOnSubmitted: true,
autoScrollToInput: false,
suggestionsBoxElevation: RecipientComposerWidgetStyle.suggestionsBoxElevation, suggestionsBoxElevation: RecipientComposerWidgetStyle.suggestionsBoxElevation,
suggestionsBoxBackgroundColor: RecipientComposerWidgetStyle.suggestionsBoxBackgroundColor, suggestionsBoxBackgroundColor: RecipientComposerWidgetStyle.suggestionsBoxBackgroundColor,
suggestionsBoxRadius: RecipientComposerWidgetStyle.suggestionsBoxRadius, suggestionsBoxRadius: RecipientComposerWidgetStyle.suggestionsBoxRadius,
@@ -85,12 +85,12 @@ class _AutocompleteContactTextFieldWithTagsState extends State<AutocompleteConta
suggestionMargin: const EdgeInsets.symmetric(vertical: 4), suggestionMargin: const EdgeInsets.symmetric(vertical: 4),
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
textInputAction: TextInputAction.done, textInputAction: TextInputAction.done,
hasAddButton: false,
tagSpacing: PlatformInfo.isWeb ? 12 : 8, tagSpacing: PlatformInfo.isWeb ? 12 : 8,
autofocus: false, autofocus: false,
minTextFieldWidth: 20, minTextFieldWidth: 20,
debounceDuration: const Duration(milliseconds: 150), debounceDuration: const Duration(milliseconds: 150),
resetTextOnSubmitted: true, resetTextOnSubmitted: true,
autoScrollToInput: false,
suggestionsBoxBackgroundColor: Colors.white, suggestionsBoxBackgroundColor: Colors.white,
suggestionsBoxRadius: 16, suggestionsBoxRadius: 16,
suggestionsBoxMaxHeight: 350, suggestionsBoxMaxHeight: 350,
@@ -112,7 +112,6 @@ class _TextFieldAutocompleteEmailAddressWebState extends State<TextFieldAutocomp
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
textInputAction: TextInputAction.done, textInputAction: TextInputAction.done,
debounceDuration: TextFieldAutoCompleteEmailAddressWebStyles.debounceDuration, debounceDuration: TextFieldAutoCompleteEmailAddressWebStyles.debounceDuration,
hasAddButton: false,
inputDecoration: InputDecoration( inputDecoration: InputDecoration(
filled: true, filled: true,
fillColor: TextFieldAutoCompleteEmailAddressWebStyles.textInputFillColor, fillColor: TextFieldAutoCompleteEmailAddressWebStyles.textInputFillColor,
@@ -134,6 +133,7 @@ class _TextFieldAutocompleteEmailAddressWebState extends State<TextFieldAutocomp
enableBorderColor: AppColor.colorInputBorderCreateMailbox, enableBorderColor: AppColor.colorInputBorderCreateMailbox,
minTextFieldWidth: TextFieldAutoCompleteEmailAddressWebStyles.minTextFieldWidth, minTextFieldWidth: TextFieldAutoCompleteEmailAddressWebStyles.minTextFieldWidth,
resetTextOnSubmitted: true, resetTextOnSubmitted: true,
autoScrollToInput: false,
suggestionsBoxElevation: TextFieldAutoCompleteEmailAddressWebStyles.suggestionBoxElevation, suggestionsBoxElevation: TextFieldAutoCompleteEmailAddressWebStyles.suggestionBoxElevation,
suggestionsBoxBackgroundColor: TextFieldAutoCompleteEmailAddressWebStyles.suggestionBoxBackgroundColor, suggestionsBoxBackgroundColor: TextFieldAutoCompleteEmailAddressWebStyles.suggestionBoxBackgroundColor,
suggestionsBoxRadius: TextFieldAutoCompleteEmailAddressWebStyles.suggestionBoxRadius, suggestionsBoxRadius: TextFieldAutoCompleteEmailAddressWebStyles.suggestionBoxRadius,
+1 -1
View File
@@ -1570,7 +1570,7 @@ packages:
description: description:
path: "." path: "."
ref: master ref: master
resolved-ref: aad6fb53c832fbe3b86f2b9eaefaab7a83392529 resolved-ref: dd81c8f1e870bacdffddda5b360c5fbe8a188bbb
url: "https://github.com/dab246/super_tag_editor.git" url: "https://github.com/dab246/super_tag_editor.git"
source: git source: git
version: "0.2.0" version: "0.2.0"