Skip to content

imhafeez/ha_firestore_realtime_paginate

Repository files navigation

All Contributors

Pub.dev Badge MIT License Badge Flutter Platform Badge

Firestore Realtime Pagination view

Flutter library for displaying realtime paginated list view or gird view based on screensize.

Features

  • Firestore Realtime pagination
  • List view style
  • Grouped List View
  • Waterflow Grid view style

Getting started

Add dependency

dependencies:
  ha_firestore_realtime_paginate: # latest version

Usage

    HAFirestoreRealtimePaginatedView(
      style: ListViewStyle.AutoStyle,
      scrollPadding: EdgeInsets.only(bottom: 90),
      query: FirebaseFirestore.instance.collection("users")
          .where("isDeleted", isEqualTo: false)
          .orderBy("addedDate", descending: true),
      limit: 10,
      builder: (context, snapshot) {
         Map<String, dynamic> data = snapshot.data() as Map<String, dynamic>;
        return ListTile(
          title: Text(data['name'] ?? "no name"),
        );
      },
      emptyWidget: Center(
        child: Text("no data found"),
      ),
    )

Grouping (Sticky Headers)

You can group your listing by passing groupBy field and your header widget in the HAFirestoreRealtimePaginatedView constructor.

HAFirestoreRealtimePaginatedView(
  ...
  groupBy: "addedDate",
  header: (groupFieldValue) {
    return Container(
      color: Colors.white,
      child: Text("$groupFieldValue"),
    );
  },
  ...
)

Filter

You can apply filter for not to include a document in the listing

bool Function(DocumentSnapshot a)? filter

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Hafeez Ahmed

💻

Baig

📖

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

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published