how to give dynamic height to pages in customscrollview

125 Views Asked by At

There are four tabs(bottom nav) and every tab has a scrolling page wrapped in Indexstack, Now the issue is if IndexedStack is wrapped with Sizebox( double.infinity) it shows empty pages, but if I set the height to double.maxFinite, then it shows complete pages but we can see the extra unlimited white space at the end of the pages.

CustomScrollView(
  slivers: [ const SliverAppBar(
    floating: true,
    expandedHeight: 0,
    title: Text("abc")
                  ), SliverToBoxAdapter(
      child: SizedBox(
        height: double.maxFinite,
        child: IndexedStack(
          index: controller.selectedTabIndex,
          children: _tabPage,
        ),
      ),
    ),],
)
1

There are 1 best solutions below

0
Tejaswini Dev On

Try this

CustomScrollView(
  slivers: [
   SliverList(
    delegate: SliverChildListDelegate(
     [
      // ....
     ],
    ),
   ),
 ],
)