TableModel constructor

TableModel({
  1. List<Column>? columns,
  2. List<Row>? rows,
  3. int? height,
  4. int? width,
  5. bool focused = false,
  6. TableKeyMap? keyMap,
  7. TableStyles? styles,
  8. HelpModel? help,
})

Creates a new table model.

Implementation

TableModel({
  List<Column>? columns,
  List<Row>? rows,
  int? height,
  int? width,
  bool focused = false,
  TableKeyMap? keyMap,
  TableStyles? styles,
  HelpModel? help,
}) : _columns = columns ?? [],
     _rows = rows ?? [],
     _cursor = 0,
     _focused = focused,
     keyMap = keyMap ?? TableKeyMap(),
     styles = styles ?? TableStyles.defaults(),
     help = help ?? HelpModel() {
  _viewport = ViewportModel(width: 0, height: 20);
  if (height != null) setHeight(height);
  if (width != null) setWidth(width);
  updateViewport();
}