简体   繁体   中英

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

finally find the answer...

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM