flutter 上拉影藏头部动画

小白 2019-09-20 原创文章



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://img.anfone.net/Outside/anfone/201666/2016661523021277.jpg',
                    fit: BoxFit.cover,
                ),
            ),
        ),
        // 列表内容
        new SliverList(
            delegate: new SliverChildBuilderDelegate((ctx, index) {
                return new Text('item: $index');
            }, childCount: this.count),
        ),
    ],)


站点信息