FLUTTER ECOSYSTEM

vedartm/paginate_firestore

Ein Flutter-Paket zur Vereinfachung der Paginierung mit Firestore-Daten 🗃

Projektcover von paginate_firestore
Stars
109
Forks
135
Letzter Push (UTC)
19.08.2024
Projektstatus
Aktiv
Venkat Vedartham GitHub avatar
GITHUB User

Venkat Vedartham ↗

Developer

Doshi App LimitedLondonOffizielle Website ↗
SprachenDartC++CMakeRubyHTMLSwiftCKotlinObjective-C

Technische Themen

Verwendete Abhängigkeiten

Abhängigkeiten 7 Einträge

Original-README

Englischer Projektschnappschuss. Aktuelle Inhalte auf GitHub.

Projekt-README ein-/ausklappen

Pagination in Firestore

All Contributors

pub package style: effective dart License: MIT

https://raw.githubusercontent.com/excogitatr/paginate_firestore/master/assets/screen.gif

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:

https://avatars1.githubusercontent.com/u/6547826?v=4?s=100
Adam Dupuis

💻
https://avatars1.githubusercontent.com/u/26927742?v=4?s=100
Gautham

💻
https://avatars3.githubusercontent.com/u/21155655?v=4?s=100
Hafeez Ahmed

💻
https://avatars3.githubusercontent.com/u/7956750?v=4?s=100
Claudemir Casa

💻
https://avatars.githubusercontent.com/u/45140298?v=4?s=100
Nikhil27bYt

📖
https://avatars.githubusercontent.com/u/1922652?v=4?s=100
Ferri Sutanto

💻
https://avatars.githubusercontent.com/u/44002583?v=4?s=100
jslattery26

💻
https://avatars.githubusercontent.com/u/68708352?v=4?s=100
garrettApproachableGeek

💻
https://avatars.githubusercontent.com/u/30954979?v=4?s=100
Sua Música

💻
https://avatars.githubusercontent.com/u/1161152?v=4?s=100
Austin Nelson

💻

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