ListModel constructor

ListModel({
  1. List<ListItem>? items,
  2. ItemDelegate? delegate,
  3. int width = 80,
  4. int height = 20,
  5. String title = 'List',
  6. bool showTitle = true,
  7. bool showFilter = true,
  8. bool showStatusBar = true,
  9. bool showPagination = true,
  10. bool showHelp = true,
  11. bool filteringEnabled = true,
  12. bool infiniteScrolling = false,
  13. String itemNameSingular = 'item',
  14. String itemNamePlural = 'items',
  15. ListKeyMap? keyMap,
  16. ListStyles? styles,
  17. FilterFunc? filter,
  18. Duration? statusMessageLifetime,
})

Creates a new list model.

Implementation

ListModel({
  List<ListItem>? items,
  ItemDelegate? delegate,
  int width = 80,
  int height = 20,
  this.title = 'List',
  this.showTitle = true,
  this.showFilter = true,
  this.showStatusBar = true,
  this.showPagination = true,
  this.showHelp = true,
  this.filteringEnabled = true,
  this.infiniteScrolling = false,
  this.itemNameSingular = 'item',
  this.itemNamePlural = 'items',
  ListKeyMap? keyMap,
  ListStyles? styles,
  FilterFunc? filter,
  Duration? statusMessageLifetime,
}) : _items = items ?? [],
     _delegate = delegate ?? DefaultItemDelegate(),
     keyMap = keyMap ?? ListKeyMap(),
     styles = styles ?? ListStyles.defaults(),
     _filter = filter ?? defaultFilter,
     statusMessageLifetime =
         statusMessageLifetime ?? const Duration(seconds: 1),
     _width = width,
     _height = height {
  paginator = PaginatorModel(
    type: PaginationType.dots,
    activeDot: this.styles.activePaginationDot ?? '●',
    inactiveDot: this.styles.inactivePaginationDot ?? '○',
  );
  filterInput = TextInputModel(prompt: 'Filter: ', charLimit: 64);
  spinner = SpinnerModel(spinner: Spinners.line);
  help = HelpModel();
  _updatePagination();
}