GithubHelp home page GithubHelp logo

claytonjacobs / paginate_firestore Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vedartm/paginate_firestore

0.0 0.0 0.0 1015 KB

A flutter package to simplify pagination with firestore data πŸ—ƒ

Home Page: https://pub.dev/packages/paginate_firestore

License: MIT License

Ruby 8.15% C++ 29.88% C 1.30% Objective-C 0.07% Kotlin 0.45% Dart 36.58% Swift 2.49% HTML 6.97% CMake 14.10%

paginate_firestore's Introduction

Pagination in Firestore

All Contributors

pub package style: effective dart License: MIT

Setup

Use the same setup used for cloud_firestore package (or follow this).

Usage

In your pubspec.yaml

dependencies:
  paginate_firestore: # latest version

Import it

import 'package:paginate_firestore/paginate_firestore.dart';

Implement it

      PaginateFirestore(
        //item builder type is compulsory.
        itemBuilder: (context, documentSnapshots, index) {
          final data = documentSnapshots[index].data() as Map?;
          return ListTile(
            leading: CircleAvatar(child: Icon(Icons.person)),
            title: data == null ? Text('Error in data') : Text(data['name']),
            subtitle: Text(documentSnapshots[index].id),
          );
        },
        // orderBy is compulsory to enable pagination
        query: FirebaseFirestore.instance.collection('users').orderBy('name'),
        //Change types accordingly
        itemBuilderType: PaginateBuilderType.listView,
        // to fetch real-time data
        isLive: true,
      ),

To use with listeners:

      PaginateRefreshedChangeListener refreshChangeListener = PaginateRefreshedChangeListener();

      RefreshIndicator(
        child: PaginateFirestore(
          itemBuilder: (context, documentSnapshots, index) => ListTile(
            leading: CircleAvatar(child: Icon(Icons.person)),
            title: Text(documentSnapshots[index].data()['name']),
            subtitle: Text(documentSnapshots[index].id),
          ),
          // orderBy is compulsary to enable pagination
          query: Firestore.instance.collection('users').orderBy('name'),
          listeners: [
            refreshChangeListener,
          ],
        ),
        onRefresh: () async {
          refreshChangeListener.refreshed = true;
        },
      )

Contributions

Feel free to contribute to this project.

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue. If you fixed a bug or implemented a feature, please send a pull request.

Getting Started

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Contributors ✨

Thanks goes to these wonderful people:


Adam Dupuis

πŸ’»

Gautham

πŸ’»

Hafeez Ahmed

πŸ’»

Claudemir Casa

πŸ’»

Nikhil27bYt

πŸ“–

Ferri Sutanto

πŸ’»

jslattery26

πŸ’»

garrettApproachableGeek

πŸ’»

Sua MΓΊsica

πŸ’»

Austin Nelson

πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!

paginate_firestore's People

Contributors

vedartm avatar allcontributors[bot] avatar claudemircasa avatar austinn avatar mafreud avatar garrettapproachablegeek avatar adamdupuis avatar atrope avatar claytonjacobs avatar fer-ri avatar imhafeez avatar nikhil27b avatar kzlakowski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.