skip to Main Content

How to make whole screen scrolling instead of just ListView scrollable?

return CustomScrollView(
                slivers: [
                  SliverAppBar(
                      actions: [
                       ....
                      ],        
                    ),
                  SliverFillRemaining(
                      child: Column(
                    children: [
                      _showWidget(context, state.tenancy),
                      TabBar(
                        unselectedLabelColor: Colors.black,
                        labelColor: Colors.red,
                        tabs: const [
                          Tab(
                            icon: Icon(Icons.people),
                          ),
                          Tab(
                            icon: Icon(Icons.person),
                          )
                        ],
                        controller: _tabController,
                        indicatorSize: TabBarIndicatorSize.tab,
                      ),
                      Expanded(
                          child: TabBarView(
                        controller: _tabController,
                        children: [
                          Text("Tab A"),
                         ListView.builder(
                              shrinkWrap: true,                                
                              itemCount: 100,
                              itemBuilder: (context, index) {
                                return Text("efff");
                              })
                          })),
                        ],
                      )),
                    ],
                  )),

2

Answers


  1. Try adding physics: NeverScrollableScrollPhysics() to your ListView.Builder.

    Login or Signup to reply.
  2. You can use bottom parameter for TabBar

    SliverAppBar(
      actions: [
        //  ....
      ],
      bottom: PreferredSize(
        preferredSize: const Size.fromHeight(50),
        child: Container(
          color: Colors.white,
          child: TabBar(
            unselectedLabelColor: Colors.black,
            labelColor: Colors.red,
            tabs: const [
              Tab(
                icon: Icon(Icons.people),
              ),
              Tab(
                icon: Icon(Icons.person),
              )
            ],
            controller: _tabController,
          ),
        ),
      ),
    ),
    

    Now you can just use the column or ListView with NeverScrollableScrollPhysics . There might be a better way instead of using NeverScrollableScrollPhysics.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search