pagination_plus 1.0.0 copy "pagination_plus: ^1.0.0" to clipboard
pagination_plus: ^1.0.0 copied to clipboard

A simple, lightweight, and responsive pagination widget for Flutter apps. It supports desktop, tablet, and mobile layouts with full customization options for rows per page, page controls, and respons [...]

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:pagination_plus/flutter_pagination.dart';


void main() {
  runApp(const Pagination());
}

class Pagination extends StatefulWidget {
  const Pagination({super.key});

  @override
  State<Pagination> createState() => _PaginationState();
}

class _PaginationState extends State<Pagination> {
  int currentPage = 0;
  int rowsPerPage = 10;

  @override
  Widget build(BuildContext context) {
    int totalRecords = 95;
    int totalPages = (totalRecords / rowsPerPage).ceil();
    int startIndex = (currentPage * rowsPerPage) + 1;
    int endIndex = ((currentPage + 1) * rowsPerPage);
    if (endIndex > totalRecords) endIndex = totalRecords;

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Flutter Pagination Example')),
        body: Column(
          children: [
            Expanded(
              child: ListView.builder(
                itemCount: endIndex - startIndex + 1,
                itemBuilder: (_, i) {
                  return ListTile(
                    title: Text('Item ${startIndex + i}'),
                  );
                },
              ),
            ),
            CustomPagination(
              currentPageIndex: currentPage,
              totalPages: totalPages,
              totalCount: totalRecords,
              rowsPerPage: rowsPerPage,
              startIndex: startIndex,
              endIndex: endIndex,
              availableRowsPerPage: const [5, 10, 20, 50],
              isTablet: false,
              isMobile: false,
              onPageChanged: (page) => setState(() => currentPage = page),
              onRowsPerPageChanged: (rows) =>
                  setState(() => rowsPerPage = rows),
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
0
points
43
downloads

Publisher

unverified uploader

Weekly Downloads

A simple, lightweight, and responsive pagination widget for Flutter apps. It supports desktop, tablet, and mobile layouts with full customization options for rows per page, page controls, and responsive behavior.

Repository (GitHub)
View/report issues

Topics

#pagination #widget #flutter #responsive

License

unknown (license)

Dependencies

flutter

More

Packages that depend on pagination_plus