MultiSearchModel<T> constructor
MultiSearchModel<T> ({
- required List<
T> items, - String title = '',
- String hint = '(Space to toggle, ^a to toggle all, Enter to confirm)',
- String placeholder = 'Type to search...',
- String noResultsText = 'No matches found',
- bool showTitle = true,
- bool showHint = true,
- bool showHelp = true,
- bool showPagination = true,
- bool highlightMatches = true,
- int height = 10,
- int initialIndex = 0,
- Set<
int> ? initialSelected, - String display(
- T
- SearchFilterFunc<
T> ? filter, - MultiSearchKeyMap? keyMap,
- SearchStyles? styles,
Implementation
MultiSearchModel({
required List<T> items,
this.title = '',
this.hint = '(Space to toggle, ^a to toggle all, Enter to confirm)',
this.placeholder = 'Type to search...',
this.noResultsText = 'No matches found',
this.showTitle = true,
this.showHint = true,
this.showHelp = true,
this.showPagination = true,
this.highlightMatches = true,
int height = 10,
int initialIndex = 0,
Set<int>? initialSelected,
this.display,
SearchFilterFunc<T>? filter,
MultiSearchKeyMap? keyMap,
SearchStyles? styles,
}) : _items = items,
_selected = initialSelected ?? {},
_filter = filter ?? defaultSearchFilter,
keyMap = keyMap ?? MultiSearchKeyMap(),
styles = styles ?? SearchStyles.defaults(),
_height = height {
_input = TextInputModel(prompt: '🔍 ', placeholder: placeholder);
_paginator = PaginatorModel(
type: PaginationType.dots,
activeDot: '●',
inactiveDot: '○',
);
_runFilter();
_cursor = initialIndex.clamp(
0,
_filteredItems.isEmpty ? 0 : _filteredItems.length - 1,
);
_updatePagination();
}