ffBody method
body
Implementation
@override
Widget? ffBody(BuildContext context) {
List<Widget> slivers = [
Theme(
//单独给子组件应用主题色
data: ThemeData(
primarySwatch: FFColor.createMaterialColor(Colors.black),
),
child: SliverAppBar(
title: Text("标题"),
expandedHeight: kToolbarHeight + 44.0,
floating: false,
pinned: true,
snap: false,
leading: IconButton(
icon: Icon(Icons.arrow_back_ios_new_outlined),
onPressed: () {
if (Navigator.canPop(context)) Navigator.pop(context);
},
),
actions: <Widget>[
IconButton(
icon: Icon(Icons.add),
onPressed: () {
print("添加");
},
),
IconButton(
icon: Icon(Icons.more_horiz),
onPressed: () {
print("更多");
},
),
],
flexibleSpace: FlexibleSpaceBar(
background: FFImageFactory.netWork(
"https://t7.baidu.com/it/u=4240641596,3235181048&fm=193&f=GIF"),
),
),
),
SliverFixedExtentList(
itemExtent: 50.0,
delegate: SliverChildBuilderDelegate(
(context, index) => ListTile(
title: Text("Item $index"),
),
childCount: 30,
),
)
];
//ClampingScrollPhysics 边缘位置不让滑
return CustomScrollView(
slivers: slivers,
physics: ClampingScrollPhysics(),
);
}