SelectModel<T> constructor

SelectModel<T>({
  1. required List<T> items,
  2. String title = 'Select an option:',
  3. bool showTitle = true,
  4. bool showHelp = true,
  5. bool showPagination = true,
  6. int height = 10,
  7. int initialIndex = 0,
  8. String display(
    1. T
    )?,
  9. SelectKeyMap? keyMap,
  10. SelectStyles? styles,
})

Creates a new select model.

Implementation

SelectModel({
  required List<T> items,
  this.title = 'Select an option:',
  this.showTitle = true,
  this.showHelp = true,
  this.showPagination = true,
  int height = 10,
  int initialIndex = 0,
  this.display,
  SelectKeyMap? keyMap,
  SelectStyles? styles,
}) : _items = items,
     keyMap = keyMap ?? SelectKeyMap(),
     styles = styles ?? SelectStyles.defaults(),
     _cursor = initialIndex.clamp(0, items.isEmpty ? 0 : items.length - 1),
     _height = height {
  _paginator = PaginatorModel(
    type: PaginationType.dots,
    activeDot: '●',
    inactiveDot: '○',
  );
  _updatePagination();
}