TF-3226 Apply minInputLength on autocomplete capability to app

This commit is contained in:
dab246
2024-10-25 16:07:06 +07:00
committed by Dat H. Pham
parent b344062068
commit 2177082c97
18 changed files with 135 additions and 10 deletions
@@ -64,6 +64,7 @@ class RecipientComposerWidget extends StatefulWidget {
final EdgeInsetsGeometry? margin;
final OnEnableAllRecipientsInputAction? onEnableAllRecipientsInputAction;
final bool isTestingForWeb;
final int minInputLengthAutocomplete;
const RecipientComposerWidget({
super.key,
@@ -71,6 +72,7 @@ class RecipientComposerWidget extends StatefulWidget {
required this.listEmailAddress,
required this.imagePaths,
required this.maxWidth,
this.minInputLengthAutocomplete = AppConfig.defaultMinInputLengthAutocomplete,
@visibleForTesting this.isTestingForWeb = false,
this.ccState = PrefixRecipientState.disabled,
this.bccState = PrefixRecipientState.disabled,
@@ -410,10 +412,13 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
}
final tmailSuggestion = List<SuggestionEmailAddress>.empty(growable: true);
if (processedQuery.length >= AppConfig.limitCharToStartSearch &&
if (processedQuery.length >= widget.minInputLengthAutocomplete &&
widget.onSuggestionEmailAddress != null) {
final listEmailAddress = await widget.onSuggestionEmailAddress!(processedQuery);
final listSuggestionEmailAddress = listEmailAddress.map((emailAddress) => _toSuggestionEmailAddress(emailAddress, _currentListEmailAddress));
final listSuggestionEmailAddress = listEmailAddress
.map((emailAddress) => _toSuggestionEmailAddress(
emailAddress,
_currentListEmailAddress));
tmailSuggestion.addAll(listSuggestionEmailAddress);
}