fix: missing To field when only other fields are filled

This commit is contained in:
dab246
2025-11-19 12:02:13 +07:00
committed by Dat H. Pham
parent a9c8dfa6a8
commit 6f6284c21f
5 changed files with 79 additions and 16 deletions
@@ -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'),