Flutter PaginatedDataTable rowsPerPage

后端 未结 5 621
我寻月下人不归
我寻月下人不归 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:18

    Let's say you have some method that fetches data from a remote server or locally and return a list of objects like this :

    List> fetchedDataObj = [
      {
        "name": "Rami",
        "email": "dummyemail01@gmail.com"
      },
      {
        "name": "Kara",
        "email": "dummyemail02@gmail.com"
      },
      {
        "name": "Lina",
        "email": "dummyemail03@almakana.com"
      }
    ];
    

    in PaginatedDataTable widget set :

    rowsPerPage: fetchedDataObj.length,
    

    and

    onRowsPerPageChanged: (fetchedDataObj.length < PaginatedDataTable.defaultRowsPerPage) ? null : (r) {
              // setState(() {
              //   _rowsPerPage = r;
              // });
            },
          ),
    

    Hope this helps. Thanks

提交回复
热议问题