fix: missing To field when only other fields are filled
This commit is contained in:
@@ -591,7 +591,7 @@ class ComposerController extends BaseController
|
||||
richTextMobileTabletController?.richTextController.hideRichTextView();
|
||||
}
|
||||
autoCreateEmailTag();
|
||||
triggerHideRecipientsFiledsWhenUnfocus();
|
||||
triggerHideRecipientsFieldsWhenUnfocus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1440,7 +1440,7 @@ class ComposerController extends BaseController
|
||||
|
||||
void clickOutsideComposer() {
|
||||
clearFocus();
|
||||
triggerHideRecipientsFiledsWhenUnfocus();
|
||||
triggerHideRecipientsFieldsWhenUnfocus();
|
||||
if (PlatformInfo.isWeb) {
|
||||
refocusKeyboardShortcutFocus();
|
||||
}
|
||||
@@ -1718,7 +1718,7 @@ class ComposerController extends BaseController
|
||||
richTextMobileTabletController?.richTextController.showDeviceKeyboard);
|
||||
}
|
||||
autoCreateEmailTag();
|
||||
triggerHideRecipientsFiledsWhenUnfocus();
|
||||
triggerHideRecipientsFieldsWhenUnfocus();
|
||||
}
|
||||
|
||||
void _onChangeCursorOnMobile(List<int>? coordinates, BuildContext context) {
|
||||
@@ -1850,7 +1850,7 @@ class ComposerController extends BaseController
|
||||
popBack();
|
||||
}
|
||||
autoCreateEmailTag();
|
||||
triggerHideRecipientsFiledsWhenUnfocus();
|
||||
triggerHideRecipientsFieldsWhenUnfocus();
|
||||
}
|
||||
|
||||
FocusNode? getNextFocusOfToEmailAddress() {
|
||||
@@ -2302,13 +2302,6 @@ class ComposerController extends BaseController
|
||||
);
|
||||
}
|
||||
|
||||
void handleEnableRecipientsInputAction(bool isEnabled) {
|
||||
fromRecipientState.value = isEnabled ? PrefixRecipientState.disabled : PrefixRecipientState.enabled;
|
||||
ccRecipientState.value = isEnabled ? PrefixRecipientState.disabled : PrefixRecipientState.enabled;
|
||||
bccRecipientState.value = isEnabled ? PrefixRecipientState.disabled : PrefixRecipientState.enabled;
|
||||
replyToRecipientState.value = isEnabled ? PrefixRecipientState.disabled : PrefixRecipientState.enabled;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> onBeforeReconnect() async {
|
||||
if (mailboxDashBoardController.accountId.value != null &&
|
||||
|
||||
@@ -527,7 +527,7 @@ class ComposerView extends GetWidget<ComposerController> {
|
||||
onClearFocusAction: controller.onClearFocusAction,
|
||||
onAddEmailAddressTypeAction: controller.addEmailAddressType,
|
||||
onDeleteEmailAddressTypeAction: controller.deleteEmailAddressType,
|
||||
onEnableAllRecipientsInputAction: controller.handleEnableRecipientsInputAction,
|
||||
onEnableAllRecipientsInputAction: controller.handleEnableRecipientsInputOnMobileAction,
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -941,7 +941,7 @@ class ComposerView extends GetWidget<ComposerController> {
|
||||
onClearFocusAction: controller.onClearFocusAction,
|
||||
onAddEmailAddressTypeAction: controller.addEmailAddressType,
|
||||
onDeleteEmailAddressTypeAction: controller.deleteEmailAddressType,
|
||||
onEnableAllRecipientsInputAction: controller.handleEnableRecipientsInputAction,
|
||||
onEnableAllRecipientsInputAction: controller.handleEnableRecipientsInputOnMobileAction,
|
||||
));
|
||||
}
|
||||
}
|
||||
+54
-1
@@ -4,6 +4,7 @@ import 'package:model/extensions/email_address_extension.dart';
|
||||
import 'package:tmail_ui_user/features/composer/presentation/composer_controller.dart';
|
||||
import 'package:tmail_ui_user/features/composer/presentation/model/prefix_recipient_state.dart';
|
||||
import 'package:tmail_ui_user/features/email/presentation/utils/email_utils.dart';
|
||||
import 'package:tmail_ui_user/main/routes/route_navigation.dart';
|
||||
|
||||
extension HandleRecipientsCollapsedExtensions on ComposerController {
|
||||
List<EmailAddress> get allListEmailAddress =>
|
||||
@@ -52,10 +53,22 @@ extension HandleRecipientsCollapsedExtensions on ComposerController {
|
||||
replyToRecipientState.value = PrefixRecipientState.enabled;
|
||||
}
|
||||
|
||||
if (currentContext != null &&
|
||||
responsiveUtils.isMobile(currentContext!) &&
|
||||
isAllRecipientInputEnabled) {
|
||||
fromRecipientState.value = PrefixRecipientState.enabled;
|
||||
}
|
||||
|
||||
updatePrefixRootState();
|
||||
requestFocusRecipientInput();
|
||||
}
|
||||
|
||||
bool get isAllRecipientInputEnabled =>
|
||||
toRecipientState.value == PrefixRecipientState.enabled &&
|
||||
ccRecipientState.value == PrefixRecipientState.enabled &&
|
||||
bccRecipientState.value == PrefixRecipientState.enabled &&
|
||||
replyToRecipientState.value == PrefixRecipientState.enabled;
|
||||
|
||||
void updatePrefixRootState() {
|
||||
if (toRecipientState.value == PrefixRecipientState.enabled) {
|
||||
prefixRootState.value = PrefixEmailAddress.to;
|
||||
@@ -98,7 +111,7 @@ extension HandleRecipientsCollapsedExtensions on ComposerController {
|
||||
}
|
||||
}
|
||||
|
||||
void triggerHideRecipientsFiledsWhenUnfocus() {
|
||||
void triggerHideRecipientsFieldsWhenUnfocus() {
|
||||
if (isRecipientsEmptyExceptReplyTo) {
|
||||
hideAllRecipientsFieldsExceptTo();
|
||||
} else if (isRecipientsWithoutReplyToNotEmpty) {
|
||||
@@ -123,4 +136,44 @@ extension HandleRecipientsCollapsedExtensions on ComposerController {
|
||||
replyToRecipientState.value = PrefixRecipientState.disabled;
|
||||
recipientsCollapsedState.value = PrefixRecipientState.disabled;
|
||||
}
|
||||
|
||||
void handleEnableRecipientsInputOnMobileAction(bool isEnabled) {
|
||||
PrefixRecipientState from;
|
||||
PrefixRecipientState to;
|
||||
PrefixRecipientState cc;
|
||||
PrefixRecipientState bcc;
|
||||
PrefixRecipientState replyTo;
|
||||
|
||||
if (!isEnabled) {
|
||||
from = PrefixRecipientState.enabled;
|
||||
to = PrefixRecipientState.enabled;
|
||||
cc = PrefixRecipientState.enabled;
|
||||
bcc = PrefixRecipientState.enabled;
|
||||
replyTo = PrefixRecipientState.enabled;
|
||||
} else if (listCcEmailAddress.isNotEmpty) {
|
||||
from = PrefixRecipientState.disabled;
|
||||
to = PrefixRecipientState.disabled;
|
||||
cc = PrefixRecipientState.enabled;
|
||||
bcc = PrefixRecipientState.disabled;
|
||||
replyTo = PrefixRecipientState.disabled;
|
||||
} else if (listBccEmailAddress.isNotEmpty) {
|
||||
from = PrefixRecipientState.disabled;
|
||||
to = PrefixRecipientState.disabled;
|
||||
cc = PrefixRecipientState.disabled;
|
||||
bcc = PrefixRecipientState.enabled;
|
||||
replyTo = PrefixRecipientState.disabled;
|
||||
} else {
|
||||
from = PrefixRecipientState.disabled;
|
||||
to = PrefixRecipientState.enabled;
|
||||
cc = PrefixRecipientState.disabled;
|
||||
bcc = PrefixRecipientState.disabled;
|
||||
replyTo = PrefixRecipientState.disabled;
|
||||
}
|
||||
|
||||
fromRecipientState.value = from;
|
||||
toRecipientState.value = to;
|
||||
ccRecipientState.value = cc;
|
||||
bccRecipientState.value = bcc;
|
||||
replyToRecipientState.value = replyTo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,8 +325,7 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
|
||||
),
|
||||
if (widget.prefix == widget.prefixRootState && _isWeb && !isMobileResponsive)
|
||||
..._buildListPrefixWidgets(),
|
||||
if (widget.prefix == widget.prefixRootState && (isMobileResponsive || widget.isTestingForWeb))
|
||||
_buildExpandButton(),
|
||||
if (_isShowExpandButton(isMobileResponsive)) _buildExpandButton(),
|
||||
if (widget.prefix != widget.prefixRootState && _isWeb && !isMobileResponsive)
|
||||
TMailButtonWidget.fromIcon(
|
||||
icon: widget.imagePaths.icClose,
|
||||
@@ -400,6 +399,24 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
|
||||
];
|
||||
}
|
||||
|
||||
bool _isShowExpandButton(bool isMobileResponsive) {
|
||||
final onlyCcEnabled = widget.toState == PrefixRecipientState.disabled &&
|
||||
widget.ccState == PrefixRecipientState.enabled;
|
||||
|
||||
final onlyBccEnabled = widget.toState == PrefixRecipientState.disabled &&
|
||||
widget.ccState == PrefixRecipientState.disabled &&
|
||||
widget.bccState == PrefixRecipientState.enabled;
|
||||
|
||||
final shouldCheckPrefix = switch (widget.prefix) {
|
||||
PrefixEmailAddress.to => widget.toState == PrefixRecipientState.enabled,
|
||||
PrefixEmailAddress.cc => onlyCcEnabled,
|
||||
PrefixEmailAddress.bcc => onlyBccEnabled,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
return shouldCheckPrefix && (isMobileResponsive || widget.isTestingForWeb);
|
||||
}
|
||||
|
||||
Widget _buildExpandButton() {
|
||||
return TMailButtonWidget.fromIcon(
|
||||
key: Key('prefix_${widget.prefix.name}_recipient_expand_button'),
|
||||
|
||||
Reference in New Issue
Block a user