【问题标题】:Flutter How to remove white blank between sliverappbar and sliverList when pull down sliverlist?Flutter下拉sliverlist时如何删除sliverappbar和sliverList之间的白色空白?
【发布时间】:2020-02-04 03:20:50
【问题描述】:

我想将 SliverAppBar 与 SliverList 一起同步下拉,但是当下拉 SliverList 时,这两个小部件之间会出现一个白色空白。

有谁知道如何删除它们之间的填充?非常感谢。

我的意思是如何设置 SliverAppBar 和 SliverList 总是互相粘连。

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

【问题讨论】:

    标签: flutter flutter-layout flutter-sliver


    【解决方案1】:

    终于找到答案了……

    需要将 CustomScrollView 的物理特性更改为 ClampingScrollPhysics 并且“顶部”小部件不会有空白。

    【讨论】:

      猜你喜欢
      • 2019-06-20
      • 2021-01-22
      • 2021-02-14
      • 2020-10-07
      • 2019-07-18
      • 2019-05-20
      • 2021-10-28
      • 2021-12-22
      • 2020-04-29
      相关资源
      最近更新 更多