want to avatar part of floats on image , avatar is with the following list or contents, and don't stretch when pull down
CustomScrollView
slivers
SliverAppBar
flexibleSpace
background: Image
SliverList
CircleAvatar
CustomScrollView(
physics: const AlwaysScrollableScrollPhysics(),
slivers: <Widget>[
SliverAppBar(
floating: true,
pinned: true,
expandedHeight: 120.0,
stretch: true,
stretchTriggerOffset: 150.0,
flexibleSpace: FlexibleSpaceBar(
background: Image.network(indexData.banner, fit: BoxFit.cover,),
),
),
SliverList(
delegate: new SliverChildBuilderDelegate((BuildContext context, int index) {
return Column(
children: <Widget>[
Row(
children: <Widget>[
Container(
width: 95,
height: 95,
margin: EdgeInsets.only(left: 16),
child: CircleAvatar(
backgroundImage: NetworkImage(indexData.avatar),
radius: 42.5,
),
decoration: new BoxDecoration(
border: new Border.all(width: 5.0, color: blackLight),
borderRadius: new BorderRadius.all(new Radius.circular(42.5)),
color: blackLight
),
)
],
)
] ,
);
}, childCount: 1 ),
),
],
)
slivers use Stack : A RenderViewport expected a child of type RenderSliver but received a child of type RenderStack.
Why only SliverList, SliverFixedExtentList, SliverGrid, SliverPadding, SliverAppBar... can be used in slivers ?
flexibleSpace: Stack( children: [ Positioned( child: Image( fit: BoxFit.cover, image: NetworkImage( widget.details, ), ), top: 0, left: 0, right: 0, bottom: 0), Positioned( child: Container( height: 20, decoration: BoxDecoration( boxShadow: [ BoxShadow( color: const Color(0x29000000), offset: Offset(0, -8), blurRadius: 15, ), ], color: Colors.white, borderRadius: BorderRadius.vertical( top: Radius.circular(50), ), ), ), bottom: -1, left: 0, right: 0, ), ], ), expandedHeight: 450.0, ), SliverList( delegate: new SliverChildBuilderDelegate( (BuildContext context, int index) { return overView(); }, childCount: 1), ), ],
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.