vedartm / paginate_firestore

A flutter package to simplify pagination with firestore data 🗃
https://pub.dev/packages/paginate_firestore
MIT License
113 stars 138 forks source link

Refresh on emptyDisplay #42

Closed Kal-Elx closed 3 years ago

Kal-Elx commented 3 years ago

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!

vedartm commented 3 years ago

I will fix this in the next version @Kal-Elx

irshaadMax commented 3 years ago

I also face this issue. On emptyDisplay it will hides my header (SliverPersistentHeader) too. Waiting owner to fix this issue.

PaginateFirestore(
        header: SliverPersistentHeader(
                pinned: true,
                delegate: _SliverSubMenuDelegate(/*submenu with categories*/) 
        ),

        itemBuilder: (index, context, documentSnapshot) {
          final data = documentSnapshot.data() as Map?;
          if(data == null) return Center(child: CircularProgressIndicator());
          return Text(documentSnapshot.id);
        },

        query: FirebaseFirestore.instance.collection('article')
                .where('article_category', index)
                .orderBy('article_date', descending: true),

        key:ValueKey<String>(selectedIndex.toString()),

        itemBuilderType: PaginateBuilderType.listView,

        isLive: true,

        itemsPerPage: 5,
); 
vedartm commented 3 years ago

Hi @irshaadMax and @Kal-Elx. This is now fixed in the latest update v1.0.2.

vedartm commented 3 years ago

Thanks for using the package. Feel free to reopen this if you face any similar issues.