Flutter 的新手,试图制作一个包含长列表视图的可滚动页面。我尝试了一些我在不同的 SO 页面上读过的不同的东西,所以我的代码可能看起来很臃肿。我不知道为什么即使页面显示正常,并且显示了最后一个 ListTile 的图像,但我无法向下滚动屏幕以查看该图像的其余部分。
class About extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.amberAccent,
appBar: AppBar(
title: Text('About this App'),
backgroundColor: Colors.lightGreen[400],
centerTitle: true,
),
body: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Text(
'The following people helped made my first app possible:',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20,
color: Colors.black,
fontWeight: FontWeight.bold)),
ListView(
shrinkWrap: true,
padding: EdgeInsets.all(15.0),
children: <Widget>[
ListTile(
leading: Text('Me'),
title: Text(
'a little about myself'),
),
ListTile(
leading: Text('Coworker'),
title: Text(
'Contribution made by coworker'),
),
ListTile(
leading: Text('Friend'),
title: Text(
'Message about friend'),
),
ListTile(
title: SizedBox(
height: 500.0,
width: 500.0,
child: Image.asset('images/friend.jpeg')),
),
],
),
])));
}
}```