【发布时间】:2021-07-16 08:28:32
【问题描述】:
编码和学习 Flutter 的超级新手。
尝试在 Flutter 中为将从云端调用数据的应用的新闻源发布模板。
飞镖代码中没有标记错误,但在运行时返回“垂直视口的高度没有限制。”。代码如下。Only appbar appears. body always blank
class Post extends StatelessWidget {
final Post post;
Post({newsfeed.post});
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Card(
elevation: 8.0,
shadowColor: Colors.grey,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)),
child: ListView(
padding: const EdgeInsets.all(10.0),
children: <Widget>[
Row(
children: [
Container(
child: ListTile(
leading: CircleAvatar(
radius: 20.0,
backgroundImage: NetworkImage(post.userimage),
),
title: Text(
post.username,
),
subtitle: Text("Post Date"),
trailing:
Icon(Icons.more_vert, color: Colors.purple[600]),
),
),
],
),
SizedBox(height: 10.0),
Row(children: [
Container(
width: 250.0,
height: 200.0,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover, image: NetworkImage(post.postimage)),
borderRadius: BorderRadius.all(Radius.circular(10.0)),
),
),
SizedBox(height: 10.0),
Row(
children: [
Icon(Icons.textcomment, color: Colors.purple[600]),
Text(post.intcomments.toString()),
SizedBox(width: 20),
Icon(Icons.favorite, color: Colors.purple[600]),
SizedBox(width: 20),
Text(post.intlikes.toString()),
],
),
SizedBox(height: 10.0),
]),
],
),
),
],
);
}
}
【问题讨论】:
标签: flutter flutter-layout flutter-web