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();
|
||||
}
|
||||
|
||||
void updateListEmailAddress(PrefixEmailAddress prefixEmailAddress,
|
||||
List<EmailAddress> newListEmailAddress) {
|
||||
void updateListEmailAddress(
|
||||
PrefixEmailAddress prefixEmailAddress,
|
||||
List<EmailAddress> newListEmailAddress
|
||||
) {
|
||||
switch(prefixEmailAddress) {
|
||||
case PrefixEmailAddress.to:
|
||||
listToEmailAddress = List.from(newListEmailAddress);
|
||||
|
||||
@@ -148,6 +148,7 @@ class EmailAddressInputBuilder {
|
||||
suggestionsBoxRadius: 20,
|
||||
suggestionsBoxMaxHeight: 300,
|
||||
textStyle: const TextStyle(color: AppColor.colorEmailAddress, fontSize: 14, fontWeight: FontWeight.w500),
|
||||
onDeleteTagAction: () => _handleDeleteTagAction(setState),
|
||||
onSubmitted: (value) {
|
||||
log('EmailAddressInputBuilder::_buildTagEditor(): onSubmitted: $value');
|
||||
if (!_isDuplicatedRecipient(value)) {
|
||||
@@ -326,11 +327,8 @@ class EmailAddressInputBuilder {
|
||||
return [];
|
||||
}
|
||||
|
||||
final currentTextOnTextField = controller?.text ?? '';
|
||||
log('EmailAddressInputBuilder::_findSuggestions():currentTextOnTextField: $currentTextOnTextField');
|
||||
final processedQuery = query.trim();
|
||||
|
||||
if (processedQuery.isEmpty || currentTextOnTextField.isEmpty) {
|
||||
if (processedQuery.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -343,6 +341,11 @@ class EmailAddressInputBuilder {
|
||||
|
||||
tmailSuggestion.addAll(_matchedSuggestionEmailAddress(processedQuery, listEmailAddress));
|
||||
|
||||
final currentTextOnTextField = controller?.text ?? '';
|
||||
if (currentTextOnTextField.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return tmailSuggestion;
|
||||
}
|
||||
|
||||
@@ -374,4 +377,27 @@ class EmailAddressInputBuilder {
|
||||
void _handleGapBetweenTagChangedAndFindSuggestion() {
|
||||
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