Flutter PaginatedDataTable rowsPerPage

后端 未结 5 637
我寻月下人不归
我寻月下人不归 2021-02-09 10:23

Can flutter PaginatedDataTable rowsPerPage be set to a number not divisible by 10?

UPDATE

Data used b

5条回答
  •  佛祖请我去吃肉
    2021-02-09 11:21

    rowsPerPage and availableRowsPerPage need to be defined together. For example:

    _rowsPerPage = 5;

    recalculate _rowsPerPage in build method:

        @override
          Widget build(BuildContext context) {
            _rowsPerPage = widget.items.length > 5 ? 5 : widget.items.length;
            return _buildCollectivePanel();
          }
    

    then add rowsPerPage, availableRowsPerPage to the PaginatedDataTable in _buildCollectivePanel()

    PaginatedDataTable(
                    header: Text("dataTableHeader"),
                    rowsPerPage: _rowsPerPage,
                    availableRowsPerPage: [_rowsPerPage, _rowsPerPage * 2, _rowsPerPage * 5, _rowsPerPage * 10],......
    

提交回复
热议问题