【发布时间】:2020-12-11 22:58:01
【问题描述】:
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')),
),
],
),
])));
}
}```
【问题讨论】:
标签: flutter listview singlechildscrollview