easy_flutter_pagination 0.0.4 copy "easy_flutter_pagination: ^0.0.4" to clipboard
easy_flutter_pagination: ^0.0.4 copied to clipboard

This component is designed for implementing pagination in Flutter.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:easy_flutter_pagination/easy_flutter_pagination.dart';

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'easy flutter pagination example',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(),
    );
  }
}

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


  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int currentPage = 0;
  int totalPages = 0;
  List<int> middlePages = [];

  @override
  Widget build(BuildContext context) {

    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            SizedBox(
                height: 40,
                width: MediaQuery.of(context).size.width,
                child: PaginationView(
                  totalPages: totalPages,
                  currentPage: currentPage,
                  getData: (returnCurrentPage, returnedMiddlePages) async {
                    currentPage = returnCurrentPage;
                    middlePages = returnedMiddlePages;
                    // get page data
                  },
                ))
          ],
        ),
      ),
    );
  }
}
5
likes
130
points
43
downloads

Publisher

unverified uploader

Weekly Downloads

This component is designed for implementing pagination in Flutter.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_bounceable

More

Packages that depend on easy_flutter_pagination