Yan Ge
Yan Ge

Reputation: 59

Flutter How to remove white blank between sliverappbar and sliverList when pull down sliverlist?

I'd like to do sync pull down for SliverAppBar together with SliverList but when pull down the SliverList, there comes a white blank between these 2 widgets.

Does anyone knows how to remove the padding between them? Thanks a lot.

What I mean is how to set SliverAppBar and SliverList always stick to each other.

Scaffold(
        body: CustomScrollView(controller: controller, slivers: [
      SliverAppBar(
        // pinned: true,
        // floating: true,
        flexibleSpace: FlexibleSpaceBar(
            background: HomeTopBar(
              picHeightExtra: picHeightExtra,
              fitMode: fitMode,
            )),
        expandedHeight: 500 + picHeightExtra,
      ),
      SliverList(
        delegate: SliverChildBuilderDelegate((context, index) {
          return Container(
            height: 50,
            color: Colors.blueAccent,
          );
        }, childCount: 30, addRepaintBoundaries: false),
      ),
    ]));

image for SliverAppBar and SliverList

Upvotes: 1

Views: 2718

Answers (1)

Yan Ge
Yan Ge

Reputation: 59

finally find the answer...

Need to change the physics for CustomScrollView to ClampingScrollPhysics and there will be no blank for the "at top" widget.

Upvotes: 4

Related Questions