TF-1354 Support delete this recipient with double backspace button in keyboard
This commit is contained in:
@@ -503,8 +503,10 @@ class ComposerController extends BaseController {
|
|||||||
_updateStatusEmailSendButton();
|
_updateStatusEmailSendButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateListEmailAddress(PrefixEmailAddress prefixEmailAddress,
|
void updateListEmailAddress(
|
||||||
List<EmailAddress> newListEmailAddress) {
|
PrefixEmailAddress prefixEmailAddress,
|
||||||
|
List<EmailAddress> newListEmailAddress
|
||||||
|
) {
|
||||||
switch(prefixEmailAddress) {
|
switch(prefixEmailAddress) {
|
||||||
case PrefixEmailAddress.to:
|
case PrefixEmailAddress.to:
|
||||||
listToEmailAddress = List.from(newListEmailAddress);
|
listToEmailAddress = List.from(newListEmailAddress);
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ class EmailAddressInputBuilder {
|
|||||||
suggestionsBoxRadius: 20,
|
suggestionsBoxRadius: 20,
|
||||||
suggestionsBoxMaxHeight: 300,
|
suggestionsBoxMaxHeight: 300,
|
||||||
textStyle: const TextStyle(color: AppColor.colorEmailAddress, fontSize: 14, fontWeight: FontWeight.w500),
|
textStyle: const TextStyle(color: AppColor.colorEmailAddress, fontSize: 14, fontWeight: FontWeight.w500),
|
||||||
|
onDeleteTagAction: () => _handleDeleteTagAction(setState),
|
||||||
onSubmitted: (value) {
|
onSubmitted: (value) {
|
||||||
log('EmailAddressInputBuilder::_buildTagEditor(): onSubmitted: $value');
|
log('EmailAddressInputBuilder::_buildTagEditor(): onSubmitted: $value');
|
||||||
if (!_isDuplicatedRecipient(value)) {
|
if (!_isDuplicatedRecipient(value)) {
|
||||||
@@ -326,11 +327,8 @@ class EmailAddressInputBuilder {
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
final currentTextOnTextField = controller?.text ?? '';
|
|
||||||
log('EmailAddressInputBuilder::_findSuggestions():currentTextOnTextField: $currentTextOnTextField');
|
|
||||||
final processedQuery = query.trim();
|
final processedQuery = query.trim();
|
||||||
|
if (processedQuery.isEmpty) {
|
||||||
if (processedQuery.isEmpty || currentTextOnTextField.isEmpty) {
|
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,6 +341,11 @@ class EmailAddressInputBuilder {
|
|||||||
|
|
||||||
tmailSuggestion.addAll(_matchedSuggestionEmailAddress(processedQuery, listEmailAddress));
|
tmailSuggestion.addAll(_matchedSuggestionEmailAddress(processedQuery, listEmailAddress));
|
||||||
|
|
||||||
|
final currentTextOnTextField = controller?.text ?? '';
|
||||||
|
if (currentTextOnTextField.isEmpty) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
return tmailSuggestion;
|
return tmailSuggestion;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,4 +377,27 @@ class EmailAddressInputBuilder {
|
|||||||
void _handleGapBetweenTagChangedAndFindSuggestion() {
|
void _handleGapBetweenTagChangedAndFindSuggestion() {
|
||||||
log('EmailAddressInputBuilder::_handleGapBetweenTagChangedAndFindSuggestion(): Timeout');
|
log('EmailAddressInputBuilder::_handleGapBetweenTagChangedAndFindSuggestion(): Timeout');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _handleDeleteTagAction(StateSetter setState) {
|
||||||
|
log('EmailAddressInputBuilder::_handleDeleteTagAction()');
|
||||||
|
if (listEmailAddress.isNotEmpty) {
|
||||||
|
setState(() {
|
||||||
|
final emailAddressDeleted = listEmailAddress.removeLast();
|
||||||
|
|
||||||
|
Future.delayed(const Duration(milliseconds: 10), () {
|
||||||
|
if (controller != null) {
|
||||||
|
controller!.text = emailAddressDeleted.emailAddress;
|
||||||
|
controller!.value = controller!.value.copyWith(
|
||||||
|
text: emailAddressDeleted.asString(),
|
||||||
|
selection: TextSelection(
|
||||||
|
baseOffset: emailAddressDeleted.asString().length,
|
||||||
|
extentOffset: emailAddressDeleted.asString().length
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
_onUpdateListEmailAddressAction?.call(_prefixEmailAddress, listEmailAddress);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user