new CustomScrollView(
physics: new BouncingScrollPhysics(),
// 需要使用 slivers 才可以
slivers: <Widget>[
// 头部内容
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滚动视觉差
最新推荐文章于 2024-04-17 09:10:34 发布