Error - 'RenderViewport does not support returning intrinsic dimensions.' on using PagedListView inside TabBarView

Viewed 41

I was using PagedListView (from This package )inside TabBarView and faced the above error. I tried wrapping the PagedListView within a container with height and width mentioned but it didn't help. Can anyone help me with this?

Relavant code:

DefaultTabController(
          length: 2,
          child: Column(
            children: [
              Container(
                margin: EdgeInsets.only(
                  top: getProportionateScreenWidth(24),
                  left: getProportionateScreenWidth(24),
                  right: getProportionateScreenWidth(24),
                ),
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.all(Radius.circular(5)),
                  color: cardColor,
                ),
                child: Padding(
                  padding: const EdgeInsets.all(2),
                  child: TabBar(
                    indicator: BoxDecoration(
                        borderRadius: BorderRadius.circular(5),
                        color: brandPurple),
                    labelColor: primaryTextColor,
                    unselectedLabelColor: secondaryTextColor,
                    tabs: [
                      Tab(text: AppLocalizations.of(context)!.pending),
                      Tab(text: AppLocalizations.of(context)!.solved),
                    ],
                  ),
                ),
                height: getProportionateScreenWidth(48),
              ),
              SizedBox(
                height: getProportionateScreenWidth(20),
              ),
              Container(
                height: getProportionateScreenHeight(575),
                child: TabBarView(children: <Widget>[
                  // pendingDoubtsBody(),
                  _paginatedPendingDoubtBody(),
                  solvedDoubtsBody(),
                ]),
              ),
            ],
          ),
        ),

_paginatedPendingDoubtsBody:

Widget _paginatedPendingDoubtBody() {
    return PagedListView(
      pagingController: _pendingPagingController,
      builderDelegate: PagedChildBuilderDelegate<TeacherDoubtModel>(
          itemBuilder: (context, doubt, index) =>
              TeacherQuestionCard(question: doubt),
          firstPageProgressIndicatorBuilder: (context) => Shimmer.fromColors(
                baseColor: Colors.white.withOpacity(0.4),
                highlightColor: Colors.grey.withOpacity(0.4),
                child: ListView.builder(
                  itemCount: 3,
                  itemBuilder: (context, index) {
                    return Padding(
                      padding: EdgeInsets.only(
                        left: getProportionateScreenWidth(24),
                        right: getProportionateScreenWidth(24),
                        bottom: getProportionateScreenHeight(12),
                      ),
                      child: Card(
                        elevation: 1.0,
                        shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(16),
                        ),
                        child: SizedBox(
                          height: getProportionateScreenHeight(133),
                          width: double.infinity,
                        ),
                      ),
                    );
                  },
                ),
              ),
          newPageProgressIndicatorBuilder: (context) => Center(
                child: CircularProgressIndicator(
                  color: Colors.white,
                ),
              ),
          noItemsFoundIndicatorBuilder: (context) => Center(
                  child: Text(
                'No doubts pending',
                style: Theme.of(context)
                    .textTheme
                    .bodyText2
                    ?.copyWith(color: Colors.white),
              )),
          firstPageErrorIndicatorBuilder: (context) => Center(
                child: Text(
                  'Some error',
                  style: Theme.of(context)
                      .textTheme
                      .bodyText2
                      ?.copyWith(color: Colors.white),
                ),
              )),
    );
  }
0 Answers
Related