Giter VIP home page Giter VIP logo

vedartm / paginate_firestore Goto Github PK

View Code? Open in Web Editor NEW
113.0 113.0 136.0 1.05 MB

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

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

License: MIT License

Kotlin 0.45% Ruby 8.15% Swift 2.49% Objective-C 0.07% Dart 36.58% HTML 6.97% CMake 14.10% C++ 29.88% C 1.30%
dart firebase firestore flutter flutter-package pagination pagination-library

paginate_firestore's People

Contributors

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

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paginate_firestore's Issues

documentation of pub.dev has not been updated

Thanks for the latest update! Support of stream is big help for me :)
By the way, I found a minor documentation bug on pub.dev.
I'd be happy to check it out!

Github(latest)

 PaginateFirestore(
        itemBuilderType: PaginateBuilderType.listView, // listview and gridview
        itemBuilder: (index, context, documentSnapshot) => ListTile(
          leading: CircleAvatar(child: Icon(Icons.person)),
          title: Text(documentSnapshot.data()['name']),
          subtitle: Text(documentSnapshot.documentID),
        ),
        // orderBy is compulsary to enable pagination
        query: Firestore.instance.collection('users').orderBy('name'),
        isLive: true // to fetch real-time data
      )

pub.dev

 PaginateFirestore(
        itemBuilder: (context, documentSnapshot) => ListTile(
          leading: CircleAvatar(child: Icon(Icons.person)),
          title: Text(documentSnapshot.data['name']),
          subtitle: Text(documentSnapshot.documentID),
        ),
        // orderBy is compulsary to enable pagination
        query: Firestore.instance.collection('users').orderBy('name'),
        isLive: true // to fetch real-time data
      )

How to update the Firestore query manually after a button press?

I have used this package for displaying the contents of my firestore collection. But I also have implemented filters such as the where clause is changed on the basis of the filter the user has chosen. I tried the store my query in a variable and change it but even after changing the query variable, I am not able to bring the filtered data. Is there any way that I can rebuild the whole PaginatedFirestore widget or any other approach that would help? Thanks.

last index

I'd like to add a widget at the very bottom of the list (that scrolls with the list). However, in order to do this, I need to know the total number of items on the list. How can I do this ? Thanks.

Search listeners on 0.2.0

Hello,

from changelog of 0.2.0 version

Added support for Search and Refresh listeners

but when I'm looking on the implementation we throw UnimplementedError

  @override
  void initState() {
    _scrollController = widget.scrollController ?? ScrollController();
    if (widget.listeners != null) {
      for (var listener in widget.listeners) {
        if (listener is PaginateRefreshedChangeListener) {
          listener.addListener(() {
            if (listener.refreshed) {
              refresh();
            }
          });
        } else if (listener is PaginateSearchChangeListener) {
          listener.addListener(() {
            throw UnimplementedError();
          });
        }
      }
    }

so should we implement SearchChangeListener ? if yes can you please provide sample

Thanks

Adding a new document

Hello,

I'm implementing a simple chat using firestore, and I need a pagination. and this library sounds amazing, it handles loaders, pagination, search, all the stuff. Thanks!

However, I want to add a new document to the collection. the new document is not appended to the list view but it's added in the collection in firestore. and it works if I refresh the listview.

Is there any good way to add elements without refreshing the list?

Rebuild with a new querry

Hello,

I am trying to implement a search bar, and I need to change the query for every new search.
Problem: The list does not refresh itself when I am changing the query using a setState.

Is it supposed to work that way? Do you recommend another solution ?

Thank you for your help,
Benjamin

search function

Hello, How do I use the search function?

I try with filterTerm but it returns a search and when I try to search for something else it is no longer possible, because the list was limited to the previous search.

The only solution I have found is refreshed all the time, but I don't think it is optimal

StreamSubscription needs to be closed

Hi

Thanks for your package. It saves a lot of my time ๐Ÿ‘

Btw, I noticed that when using isLive option as true, the stream is always active even we moved into another screen.

We need to capture the StreamSubscription from this line https://github.com/excogitatr/paginate_firestore/blob/master/lib/bloc/pagination_cubit.dart#L86 and cancel() on dispose.

Something like this

List<StreamSubscription<QuerySnapshot>>() streams = List<StreamSubscription<QuerySnapshot>>();

...

_getLiveDocuments() {
    ...
      StreamSubscription listener = localQuery.snapshots().listen((querySnapshot) {
        _emitPaginatedState(
          querySnapshot.docs,
          previousList:
              loadedState.documentSnapshots as List<QueryDocumentSnapshot>,
        );
      });
    }

  streams.add(listeners);
  }

...

streams.forEach((listener) => listener.cancel());

Thanks

Some features

It would be good if could animate data that fetches in real-time.

ListView is not scrollable

I am using the widget PaginateFirestore. It fetches data but the list is not scrolling. here is code.

 @override
  Widget build(BuildContext context) {
    return BlocProvider<TalentFavCubit>(
      create: (context) => TalentFavCubit(),
      child: SafeArea(
        child: Scaffold(
          body: Padding(
            padding: const EdgeInsets.all(20.0),
            child: SingleChildScrollView(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                children: <Widget>[
                  Text('Talent Screen 1 home search'),
                  // _retrieveAllDocs,
                  _retrieveData,
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }

  Widget get _retrieveData => PaginateFirestore(
    scrollDirection: Axis.vertical,
        physics: AlwaysScrollableScrollPhysics(),
        shrinkWrap: true,
        itemBuilderType: PaginateBuilderType.listView,
        query: FirebaseRepo.instance.fetchWorkerFormFieldsData(),
        itemBuilder: (index, context, documentSnapshot) {
          var data = documentSnapshot.data();
          return theUserInfo(data);
        },
        isLive: true,
      );

  Widget theUserInfo(var data) {
    TalentHireFavModel userData =
                   TalentHireFavModel.fromMap(data);
    return Card(
      child: Column(
        children: <Widget>[
          Text(userData.categories),
          SizedBox(height: 100.0,),
          Text(userData.skills),
          Text(userData.phoneNo),
          Text(userData.hourlyRate),
          Text(userData.professionalOverview),
          Text(userData.skills),
          Text(userData.expert),
          //_iconButton(userData.uid),
        ],
      ),
    );
  }
  
```}

Refresh on emptyDisplay

Right now you can't refresh when emptyDisplay is shown. This is because emptyDisplay isn't a child of a Scrollable.

I have solved it like this but it would be nice if this was the default behaviour.

    RefreshIndicator(
      child: PaginateFirestore(
        ...
        emptyDisplay: LayoutBuilder(
          builder: (ctx, constraints) => SingleChildScrollView(
            physics: AlwaysScrollableScrollPhysics(),
            child: Container(
              height: constraints.maxHeight,
              child: EmptyDisplay(),
            ),
          ),
        ),
      ),
    );

Thanks for a great package!

cache query

Hi,
any plan to support cache query ? as you know we cannot imagine usage of firestore without caching for most of use case, just close and open the app will trigger new docs read if no local cache configured

Update Bloc Library

Because every version of paginate_firestore depends on flutter_bloc ^4.0.0 and project depends on flutter_bloc ^5.0.1, paginate_firestore is forbidden.

So, because project depends on paginate_firestore ^0.1.1, version solving failed.
pub get failed (1; So, because project depends on paginate_firestore ^0.1.1, version solving failed.)

How to cast Document snapshot to my Model.

Thank you for this amazing library. Just wanna know what is the proper method to cast documentSnapshot to my Model i.e Product.
tried this inside item itemBuilder, but doesn't work.
Product products =documentSnapshot.data() as Product;

Error is _InternalLinkedHashMap<String, dynamic>' is not a subtype of type documentSnapshot.data.
Update: Ok, seems am doing it wrong. Can anyone help me mapping the snapshot data to an object

Index

Would be awesome to have an index in the itemBuilder function!

How to change the default no documents found message

Please I need to change the default no document found message when there are no documents found. I have used:

`if(snapshot.data().isEmpty || snapshot.data().length < 1 || !snapshot.data().isNotEmpty){

return Container(
margin: EdgeInsets.only(top: 170),
child: NoDataAvailable(
message: 'No Video posts Yet',
),
);
}`

but i still get the no document found message

Work with Sliver(NestedScrollView) scroll with SliverAppBar not working

hello ..
I love your packages but my project need to tab .
when I use this package on NestedScrollView but scroll with SliverAppBar not working .
if I fixed that by SliverChildListDelegate or any widget has scroll I have another problem with paginate firestore it's get all document in once .
how I fixed that ?
thank u ...

auto scrolling function

Thank you for contributing your excellent package.
Would it be possible to scroll automatically according to the given timer setting value?
Except basic ui, I want to use this package for upper screen on youtube screen and lower paginated firestore text data.
Thanks!

Always show header

Is it possible to show the header widget even when no documents are found in the query?

Using in ListView

Is it possible to use this widget inside a ListView? It seems that all elements are loaded when I put it in a ListView.

Listener example is not working

Listener example is not working
I am receiving syntax errors in Android Studio and will it be able to update whenever a collection changes with pulling a loader

Filtered result .

Hi,

Firestore document has a field called 'category' , i need to filter only those category field results ex: 'category' == 'men' or category == 'women'. So how do i filter documents based on these inputs . Can u give example code ?

package status

Hi
I would like to have a status about this package, so @excogitatr @adamdupuis @claudemircasa @imhafeez @GauthamAsir all others contributors if it's possible to have answer of those questions :

  • do you have stop working on this package ? if yes please inform
  • any news about Support of streaming ?
  • do you plan to add cache query support ?
  • package is not up to date with last firestore version, so we cannot upgrade firebase due to this, so any plan to do this ?
  • what about open bugs ? there is no answer since 23 days for new open bugs

Thank you for your understanding

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.