am尝试在SliverAppBar下方添加carousel_slider
需要在contentView之前添加静态滑块
body: Builder(
builder: (BuildContext context) {
return RefreshIndicator(
child: CustomScrollView(
controller: _scrollController,
slivers: <Widget>[
SliverAppBar(
primary: false,
expandedHeight: 75,
backgroundColor: Color(0xFFf4eedd),
floating: true,
actions: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('images/banner.png'),
fit: BoxFit.fitWidth)),
),
],
),
contentView,
],
),
onRefresh: () async {
this._pageLoadController.reset();
await Future.value({});
},
);
},
));
contentView,这是一个来自json向下滚动的项目
答案 0 :(得分:0)
我用SliverToBoxAdapter做到
body: Builder(
builder: (BuildContext context) {
return RefreshIndicator(
child: CustomScrollView(
controller: _scrollController,
slivers: <Widget>[
SliverAppBar(
primary: false,
expandedHeight: 75,
backgroundColor: Color(0xFFf4eedd),
floating: true,
actions: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('images/banner.png'),
fit: BoxFit.fitWidth)),
),
],
),
SliverToBoxAdapter(
child: Container(
height: 100.0,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: 10,
itemBuilder: (context, index) {
return Container(
width: 100.0,
child: Card(
child: Text('data'),
),
);
},
),
)),
contentView,
],
),
onRefresh: () async {
this._pageLoadController.reset();
await Future.value({});
},
);
},
)