Flutter 滾動視覺差

new CustomScrollView(
    physics: new BouncingScrollPhysics(),
    // 需要使用 slivers 才可以
    slivers: [
        // 头部内容
        new SliverAppBar(
            // 高度
            expandedHeight: 256.0,
            pinned: true,
            floating: !true,
            snap: !true,
            flexibleSpace: new FlexibleSpaceBar(
                // 标题
                title: Text('标题'),
                centerTitle: true,
                // 背景图
                background: new Image.network(
                    'http://letsfilm.org/wp-content/uploads/2019/03/everaldo-coelho-486014-unsplash.jpg',
                    fit: BoxFit.cover,
                ),
            ),
        ),
        // 列表内容
        new SliverList(
            delegate: new SliverChildBuilderDelegate((ctx, index) {
                return new Text('item: $index');
            }, childCount: this.count),
        ),
    ],
)

你可能感兴趣的:(flutter)