पैकेज, रिपॉज़िटरी और ऐप श्रेणियाँ खोजें

पैकेज विवरणv0.1.0

firestore_paging_controller

उपयोगकर्ता के स्क्रीन के नीचे स्क्रॉल करते समय आइटम के पेज को लेटीली लोड और प्रदर्शित करें, Firestore के साथ कुछ सुधारों के साथ।

AndroidiOSWebmacOSWindows
30-दिन डाउनलोड
42
लाइक
13
Pub अंक
150

पैकेज इंस्टॉल करें

flutter pub add firestore_paging_controller

पैकेज अवलोकन

सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।

एक फ्लटर पैकेज जो पृष्ठांकित रूप से फायरस्टोर डेटा के लेट लोडिंग की अनुमति देता है, दृश्य या निकटवर्ती पृष्ठों को ही लोड करके स्क्रॉल प्रदर्शन में सुधार करता है। इसमें बिल्ट-इन राज्य प्रबंधन और त्रुटि संभाल के साथ अनंत स्क्रॉलिंग के लिए सरलीकरण किया गया है। Firebase Firestore के साथ बिना किसी दिक्कत के एकीकरण के लिए डिज़ाइन किया गया है, यह कुशल डेटा स्ट्रीमिंग का समर्थन करता है और अनावश्यक नेटवर्क अनुरोधों को कम करता है। बड़े डेटासेट वाली सूचियों के लिए आदर्श, जैसे फीड, चैट इतिहास या उत्पाद कैटलॉग।

उपयोग

  • अनंत स्क्रॉल सूचियाँ
  • चैट संदेश लोड हो रहा है
  • उत्पाद कैटलॉग पेज़ेशन
  • उपयोगकर्ता फीड प्रदर्शित करता है
  • रियल-टाइम डेटा स्ट्रीम

मुख्य विशेषताएँ

  • Firestore के साथ लेजी लोडिंग
  • बिल्ट-इन पेजिंग अवस्था
  • त्रुटि और लोडिंग स्थितियाँ
  • निर्भर नेटवर्क उपयोग
  • ListView के साथ आसान एकीकरण
  • स्क्रॉल पर स्वचालित पेज फ़ेचिंग

इनके लिए उपयुक्त

  • बड़े Firestore डेटासेट वाले ऐप्स
  • अनंत स्क्रॉल यूआई
  • रियल-टाइम डेटा प्रदर्शन
  • प्रदर्शन-संवेदनशील ऐप
  • Firebase-आधारित एप्लिकेशन

विचार योग्य बातें

  • Firestore सेटअप की आवश्यकता है
  • फायरस्टोर डेटा स्रोतों तक सीमित
  • कस्टम क्वेरी लॉजिक की आवश्यकता हो सकती है
  • छोटे डेटासेट के लिए उपयुक्त नहीं
  • इंटरनेट कनेक्टिविटी पर निर्भर करता है

मूल README

संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।

Firestore Paging Controller

This is a simple Firestore Paging Controller package build on top of the infinite_scroll_pagination package. It provides a simple way to paginate through Firestore collections.

Additionally, it provides a simple way to merge multiple queries into a single stream, which ultimately allows you to have an OR query. On top of that, it also allows ordering the results of the merged queries, which is not possible with Firestore. Internally, it uses the buffer to make sure it doesn't show the items in the wrong order.

Getting Started

To use this package, you need to add the following dependency in your pubspec.yaml file:

dependencies:
  firestore_paging_controller: any

Usage

To use this package, you need to create a FirestorePagingController and (optionally) pass it the queries you want to paginate through. Here is an example:

import 'package:firestore_paging_controller/firestore_paging_controller.dart';

final controller = FirestorePagingController.withoutType(
  basePath: 'posts',
  queryBuilders: [
    (query) => query.where('creatorId', isEqualTo: userId),
    (query) => query.where('taggedUserId', isEqualTo: userId),
  ],
  orderBy: 'createdAt',
  orderByDescending: true,
  pageSize: 10,
);

This will create a controller that will paginate through the items that have the creatorId or taggedUserId equal to the userId. The controller will fetch 10 items per page for each query.

After creating the controller, you can use it in a widget from the infinite_scroll_pagination package. Here is an example:

PagedListView(
  pagingController: controller,
  builderDelegate: PagedChildBuilderDelegate<QueryDocumentSnapshot<Map<String, dynamic>>>(
    itemBuilder: (context, snapshot, index) => Post(snapshot.data()),
  ),
);

If you want to use the type-safe version of the controller, you can do the following:

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firestore_paging_controller/firestore_paging_controller.dart';

final controller = FirestorePagingController<PostModel>.converted(
  basePath: 'posts',
  queryBuilders: [
    (query) => query.where('creatorId', isEqualTo: userId),
    (query) => query.where('taggedUserId', isEqualTo: userId),
  ],
  orderBy: 'createdAt',
  orderByDescending: true,
  pageSize: 10,
  fromMap: (data) => PostModel.fromMap(data),
);

Then it can be used like this:

PagedListView<int, QueryDocumentSnapshot<T>>(
  pagingController: controller,
  builderDelegate: PagedChildBuilderDelegate<QueryDocumentSnapshot<T>>(
    itemBuilder: (context, snapshot, index) => Post(snapshot.data()),
  ),
);

Reminders:

  • The queries you pass to the controller should not have any limit or orderBy applied to them.
  • You may need to create an index in Firestore for the queries you are using in the controller. Look at the logs for the error message and create the index accordingly.

श्रेणियाँ

निर्भरताएँ

निर्भरता सूची 2 आइटम

सोर्स रिपॉज़िटरी

इस पैकेज का उपयोग करने वाले प्रोजेक्ट

अभी कोई डेटा उपलब्ध नहीं है।