vedartm / paginate_firestore

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

ListView is not scrollable #66

Closed hammasali closed 3 years ago

hammasali commented 3 years ago

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),
        ],
      ),
    );
  }

```}
vedartm commented 3 years ago

Hey @hammasali . You can use the package without any external scroll view as it scrolls by default.

Try changing your code to this.

  @override
  Widget build(BuildContext context) {
    return BlocProvider<TalentFavCubit>(
      create: (context) => TalentFavCubit(),
      child: SafeArea(
        child: Scaffold(
          body:  _retrieveData,
        ),
      ),
    );
  }

And you can add your padding inside the PaginateFirestore widget.

vedartm commented 3 years ago

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