renderCustomPagination property

Widget Function(int count, int page, void onChange(int page))? renderCustomPagination
final

Renders a custom pagination widget with three parameters.

First parameter, count, returns the total page count of the datatable.

Second parameter, page, returns the current page value.

Last parameter, onChange, is a function and it must return a new integer page variable to update the value of the current page.

renderCustomPagination: (count, page, onChange) {
  return Row(
    mainAxisAlignment: MainAxisAlignment.spaceAround,
    children: [
      TextButton(
        onPressed: () {
          if (page > 0) {
            onChange(page - 1);
          }
        },
        child: const Text("Previous"),
      ),
      Text("Total: $count"),
      Text("Current index: $page"),
      TextButton(
        onPressed: () {
          if (page < count - 1) {
            onChange(page + 1);
          }
        },
        child: const Text("Next"),
      ),
    ],
  );
}

Implementation

final Widget Function(
  int count,
  int page,
  void Function(int page) onChange,
)? renderCustomPagination;