ListModel constructor
ListModel({
- List<
ListItem> ? items, - ItemDelegate? delegate,
- int width = 80,
- int height = 20,
- String title = 'List',
- bool showTitle = true,
- bool showFilter = true,
- bool showStatusBar = true,
- bool showPagination = true,
- bool showHelp = true,
- bool filteringEnabled = true,
- bool infiniteScrolling = false,
- String itemNameSingular = 'item',
- String itemNamePlural = 'items',
- ListKeyMap? keyMap,
- ListStyles? styles,
- FilterFunc? filter,
- 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();
}