Flutter的FlexibleSpaceBar
- FlexibleSpaceBar
// FlexibleSpaceBar
class FlexibleSpaceBarDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverAppBar(
// 展开高度
expandedHeight: 250.0,
// 是否随着滑动隐藏标题
floating: true,
// 是否固定在顶部
pinned: true,
// 可折叠的应用栏目
flexibleSpace: FlexibleSpaceBar(
centerTitle: true,
title: Text('可折叠的标题', style: TextStyle(color: Colors.white),),
background: Image.network('https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2288748976,1582581638&fm=26&gp=0.jpg', fit: BoxFit.cover,),
),
)