用 NestedScrollView 解决的。可能是 CustomScrollView 太原始了……
Git 上更新的这个问题解决的代码。
下面是这次修改的片段。
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColor.bColor,
appBar: PreferredSize(
child: AppBar(
backgroundColor: AppColor.red,
flexibleSpace: Stack(
children: [
Positioned(
child: Image.asset(
'assets/images/logo.png',
width: ScreenUtil().setWidth(100),
),
left: ScreenUtil().setWidth(324),
right: ScreenUtil().setWidth(324),
bottom: ScreenUtil().setWidth(36),
),
],
),
),
preferredSize: Size.fromHeight(ScreenUtil().setWidth(180)),
),
body: NestedScrollView(
headerSliverBuilder: (context, boxIsScrolled) {
return [
SliverToBoxAdapter(
child: Column(
children: [
Search(),
Banner(),
Msg(),
],
),
),
];
},
body: CustomScrollView(slivers: [
SliverPersistentHeader(
pinned: true,
delegate: _SliverAppBarDelegate(
minHeight: ScreenUtil().setWidth(90),
maxHeight: ScreenUtil().setWidth(90),
child: FilterBar(),
),
),
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return PropertyListItem(
id: index,
);
},
childCount: 1,
),
)
]),
),
);
}
}
这个群里问的,还是得有个群哪……
群号:181398081