TF-3408 Remove limit result in autocomplete
This commit is contained in:
@@ -1110,14 +1110,15 @@ class ComposerController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
Future<List<EmailAddress>> getAutoCompleteSuggestion(String queryString) async {
|
||||
log('ComposerController::getAutoCompleteSuggestion(): $queryString | $_contactSuggestionSource');
|
||||
Future<List<EmailAddress>> getAutoCompleteSuggestion(String queryString, {int? limit}) async {
|
||||
log('ComposerController::getAutoCompleteSuggestion():queryString = $queryString | limit = $limit | $_contactSuggestionSource');
|
||||
_getAllAutoCompleteInteractor = getBinding<GetAllAutoCompleteInteractor>();
|
||||
_getAutoCompleteInteractor = getBinding<GetAutoCompleteInteractor>();
|
||||
_getDeviceContactSuggestionsInteractor = getBinding<GetDeviceContactSuggestionsInteractor>();
|
||||
|
||||
final autoCompletePattern = AutoCompletePattern(
|
||||
word: queryString,
|
||||
limit: limit,
|
||||
accountId: mailboxDashBoardController.accountId.value);
|
||||
|
||||
if (_contactSuggestionSource == ContactSuggestionSource.all) {
|
||||
|
||||
@@ -8,7 +8,7 @@ class RecipientComposerWidgetStyle {
|
||||
static const double enableBorderRadius = 10;
|
||||
static const double suggestionsBoxElevation = 20.0;
|
||||
static const double suggestionsBoxRadius = 20;
|
||||
static const double suggestionsBoxMaxHeight = 350;
|
||||
static const double suggestionsBoxMaxHeight = 300;
|
||||
static const double suggestionBoxWidth = 300;
|
||||
static const double minTextFieldWidth = 20;
|
||||
static const double tagSpacing = 8;
|
||||
|
||||
@@ -27,7 +27,7 @@ import 'package:tmail_ui_user/features/composer/presentation/widgets/recipient_t
|
||||
import 'package:tmail_ui_user/main/localizations/app_localizations.dart';
|
||||
import 'package:tmail_ui_user/main/utils/app_config.dart';
|
||||
|
||||
typedef OnSuggestionEmailAddress = Future<List<EmailAddress>> Function(String word);
|
||||
typedef OnSuggestionEmailAddress = Future<List<EmailAddress>> Function(String word, {int? limit});
|
||||
typedef OnUpdateListEmailAddressAction = void Function(PrefixEmailAddress prefix, List<EmailAddress> newData);
|
||||
typedef OnAddEmailAddressTypeAction = void Function(PrefixEmailAddress prefix);
|
||||
typedef OnDeleteEmailAddressTypeAction = void Function(PrefixEmailAddress prefix);
|
||||
@@ -213,7 +213,13 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
|
||||
);
|
||||
},
|
||||
onTagChanged: (value) => _handleOnTagChangeAction.call(value, stateSetter),
|
||||
findSuggestions: _findSuggestions,
|
||||
findSuggestions: (queryString) => _findSuggestions(
|
||||
queryString,
|
||||
limit: AppConfig.defaultLimitAutocomplete,
|
||||
),
|
||||
isLoadMoreOnlyOnce: true,
|
||||
isLoadMoreReplaceAllOld: false,
|
||||
loadMoreSuggestions: _findSuggestions,
|
||||
useDefaultHighlight: false,
|
||||
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress, index, length, highlight, suggestionValid) {
|
||||
return RecipientSuggestionItemWidget(
|
||||
@@ -297,7 +303,13 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
|
||||
);
|
||||
},
|
||||
onTagChanged: (value) => _handleOnTagChangeAction.call(value, stateSetter),
|
||||
findSuggestions: _findSuggestions,
|
||||
findSuggestions: (queryString) => _findSuggestions(
|
||||
queryString,
|
||||
limit: AppConfig.defaultLimitAutocomplete,
|
||||
),
|
||||
isLoadMoreOnlyOnce: true,
|
||||
isLoadMoreReplaceAllOld: false,
|
||||
loadMoreSuggestions: _findSuggestions,
|
||||
useDefaultHighlight: false,
|
||||
suggestionBuilder: (context, tagEditorState, suggestionEmailAddress, index, length, highlight, suggestionValid) {
|
||||
return RecipientSuggestionItemWidget(
|
||||
@@ -402,7 +414,7 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
|
||||
? _currentListEmailAddress.sublist(0, 1)
|
||||
: _currentListEmailAddress;
|
||||
|
||||
FutureOr<List<SuggestionEmailAddress>> _findSuggestions(String query) async {
|
||||
FutureOr<List<SuggestionEmailAddress>> _findSuggestions(String query, {int? limit}) async {
|
||||
if (_gapBetweenTagChangedAndFindSuggestion?.isActive ?? false) {
|
||||
return [];
|
||||
}
|
||||
@@ -415,7 +427,10 @@ class _RecipientComposerWidgetState extends State<RecipientComposerWidget> {
|
||||
final tmailSuggestion = List<SuggestionEmailAddress>.empty(growable: true);
|
||||
if (processedQuery.length >= widget.minInputLengthAutocomplete &&
|
||||
widget.onSuggestionEmailAddress != null) {
|
||||
final listEmailAddress = await widget.onSuggestionEmailAddress!(processedQuery);
|
||||
final listEmailAddress = await widget.onSuggestionEmailAddress!(
|
||||
processedQuery,
|
||||
limit: limit,
|
||||
);
|
||||
final listSuggestionEmailAddress = listEmailAddress
|
||||
.map((emailAddress) => _toSuggestionEmailAddress(
|
||||
emailAddress,
|
||||
|
||||
Reference in New Issue
Block a user