它可能是这样的:
body: Column(
children: <Widget>[
timeTable(),
SizedBox(
height: 18,
),
Expanded(
child: Stack(
child: ListView.separated(
itemCount: 5,
separatorBuilder: (context, index) => SizedBox(
height: 24.0,
),
itemBuilder: (context, index) => statisticItem(),
),
FadeEndListView(),
),
)
],
),
其中 FadeEndListView 是:
class FadeEndListView extends StatelessWidget {
const FadeEndListView({
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Positioned(
bottom: 0,
left: 0,
right: 0,
height: 70,
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: [0.0, 1.0],
colors: [
Theme.of(context).scaffoldBackgroundColor.withOpacity(0.0),
Theme.of(context).scaffoldBackgroundColor,
],
),
),
),
);
}
}
我的回答来自:淡入淡出边缘 ListView - Flutter https://stackoverflow.com/questions/51066628/fading-edge-listview-flutterYariv.A 的回答。有小的变化。