TF-3944 Automatically close CC, Bcc, ReplyTo input field when clicking outside of it, regardless of whether it has been filled or not

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-08-06 00:53:02 +07:00
committed by Dat H. Pham
parent 9038f8b554
commit 575abd235f
2 changed files with 26 additions and 3 deletions
@@ -586,6 +586,9 @@ class ComposerController extends BaseController
} }
_collapseAllRecipient(); _collapseAllRecipient();
autoCreateEmailTag(); autoCreateEmailTag();
if (PlatformInfo.isWeb) {
_hideCcBccReplyToRecipients();
}
} }
} }
@@ -1359,6 +1362,14 @@ class ComposerController extends BaseController
FocusScope.of(context).unfocus(); FocusScope.of(context).unfocus();
} }
void clickOutsideComposer(BuildContext context) {
clearFocus(context);
if (PlatformInfo.isWeb) {
_collapseAllRecipient();
_hideCcBccReplyToRecipients();
}
}
void _closeComposerAction({dynamic result, bool closeOverlays = false}) { void _closeComposerAction({dynamic result, bool closeOverlays = false}) {
mailboxDashBoardController.closeComposer( mailboxDashBoardController.closeComposer(
result: result, result: result,
@@ -1432,6 +1443,12 @@ class ComposerController extends BaseController
replyToAddressExpandMode.value = ExpandMode.COLLAPSE; replyToAddressExpandMode.value = ExpandMode.COLLAPSE;
} }
void _hideCcBccReplyToRecipients() {
ccRecipientState.value = PrefixRecipientState.disabled;
bccRecipientState.value = PrefixRecipientState.disabled;
replyToRecipientState.value = PrefixRecipientState.disabled;
}
void _closeSuggestionBox() { void _closeSuggestionBox() {
if (toEmailAddressController.text.isEmpty) { if (toEmailAddressController.text.isEmpty) {
keyToEmailTagEditor.currentState?.closeSuggestionBox(); keyToEmailTagEditor.currentState?.closeSuggestionBox();
@@ -1660,6 +1677,9 @@ class ComposerController extends BaseController
} }
_collapseAllRecipient(); _collapseAllRecipient();
autoCreateEmailTag(); autoCreateEmailTag();
if (PlatformInfo.isWeb) {
_hideCcBccReplyToRecipients();
}
} }
void _onChangeCursorOnMobile(List<int>? coordinates, BuildContext context) { void _onChangeCursorOnMobile(List<int>? coordinates, BuildContext context) {
@@ -1791,6 +1811,9 @@ class ComposerController extends BaseController
void handleOnMouseDownHtmlEditorWeb() { void handleOnMouseDownHtmlEditorWeb() {
_collapseAllRecipient(); _collapseAllRecipient();
autoCreateEmailTag(); autoCreateEmailTag();
if (PlatformInfo.isWeb) {
_hideCcBccReplyToRecipients();
}
} }
FocusNode? getNextFocusOfToEmailAddress() { FocusNode? getNextFocusOfToEmailAddress() {
@@ -44,7 +44,7 @@ class ComposerView extends GetWidget<ComposerController> {
mobile: MobileResponsiveContainerView( mobile: MobileResponsiveContainerView(
childBuilder: (context, constraints) { childBuilder: (context, constraints) {
return GestureDetector( return GestureDetector(
onTap: () => controller.clearFocus(context), onTap: () => controller.clickOutsideComposer(context),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@@ -342,7 +342,7 @@ class ComposerView extends GetWidget<ComposerController> {
desktop: Obx(() => DesktopResponsiveContainerView( desktop: Obx(() => DesktopResponsiveContainerView(
childBuilder: (context, constraints) { childBuilder: (context, constraints) {
return GestureDetector( return GestureDetector(
onTap: () => controller.clearFocus(context), onTap: () => controller.clickOutsideComposer(context),
child: Column(children: [ child: Column(children: [
Obx(() => DesktopAppBarComposerWidget( Obx(() => DesktopAppBarComposerWidget(
imagePaths: controller.imagePaths, imagePaths: controller.imagePaths,
@@ -666,7 +666,7 @@ class ComposerView extends GetWidget<ComposerController> {
tablet: TabletResponsiveContainerView( tablet: TabletResponsiveContainerView(
childBuilder: (context, constraints) { childBuilder: (context, constraints) {
return GestureDetector( return GestureDetector(
onTap: () => controller.clearFocus(context), onTap: () => controller.clickOutsideComposer(context),
child: Column(children: [ child: Column(children: [
Obx(() => DesktopAppBarComposerWidget( Obx(() => DesktopAppBarComposerWidget(
imagePaths: controller.imagePaths, imagePaths: controller.imagePaths,