MultiSearchModel<T> constructor

MultiSearchModel<T>({
  1. required List<T> items,
  2. String title = '',
  3. String hint = '(Space to toggle, ^a to toggle all, Enter to confirm)',
  4. String placeholder = 'Type to search...',
  5. String noResultsText = 'No matches found',
  6. bool showTitle = true,
  7. bool showHint = true,
  8. bool showHelp = true,
  9. bool showPagination = true,
  10. bool highlightMatches = true,
  11. int height = 10,
  12. int initialIndex = 0,
  13. Set<int>? initialSelected,
  14. String display(
    1. T
    )?,
  15. SearchFilterFunc<T>? filter,
  16. MultiSearchKeyMap? keyMap,
  17. 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();
}