当我试图在单一儿童发展中心使用卡片时 我认为,我有这一错误:
The following assertion was thrown during layout:
A RenderFlex overflowed by 178 pixels on the bottom.
The relevant error-causing widget was:
Column file:///C:/Users/emirs/AndroidStudioProjects/view_met/lib/home.dart:197:16
The overflowing RenderFlex has an orientation of Axis.vertical.
The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the RenderFlex to fit within the available space instead of being sized to their natural size.
This is considered an error condition because it indicates that there is content that cannot be seen. If the content is legitimately bigger than the available space, consider clipping it with a ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex, like a ListView.
The specific RenderFlex in question is: RenderFlex#d861f relayoutBoundary=up2 OVERFLOWING
... needs compositing
... parentData: offset=Offset(0.0, 0.0) (can use size)
... constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=820.6)
... size: Size(411.4, 820.6)
... direction: vertical
... mainAxisAlignment: start
... mainAxisSize: max
... crossAxisAlignment: center
... verticalDirection: down
◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
这是我的法典:
Padding(
padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
child: Column(
children: <Widget>[
Text("Random Items You Could Like", style: GoogleFonts.merriweather(fontSize: 18, color: Colors.black)),
SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
children: <Widget>[
builder(randint1.toString()),
builder(randint2.toString()),
builder(randint3.toString()),
builder(randint4.toString()),
builder(randint5.toString()),
],
)
),
],
),
)
代表:
builder(String id) {
return FutureBuilder(
future: fetchData(id),
builder: (BuildContext context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Padding(
padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
child: CircularProgressIndicator(),
);
}
var data = jsonDecode(snapshot.data.toString());
var leading;
var artist;
if (data["primaryImageSmall"] == "") {
leading = Icon(Icons.dangerous);
}
else {
leading = Image.network(data["primaryImageSmall"]);
}
if (data["artistDisplayName"]== "") {
artist = "Unknown";
}
else {
artist = data["artistDisplayName"];
}
return Card(
clipBehavior: Clip.antiAlias,
child: Column(
children: [
ListTile(
leading: leading,
title: Text(data["title"]),
subtitle: Text(
"by $artist",
style: TextStyle(color: Colors.black.withOpacity(0.6)),
),
),
ButtonBar(
alignment: MainAxisAlignment.start,
children: [
TextButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => DetailsPage()),
);
},
child: Text("Details", style: TextStyle(color: Color(0xFF6200EE))),
),
TextButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => DetailsPage()),
);
},
child: Text("Add to Favorites", style: TextStyle(color: Color(0xFF6200EE))),
),
],
),
],
),
);
},
);
}
结果是:
我也审视了其他问题,但没有任何问题得到实际帮助,他们没有找到我正在寻求的答案。 我确实不知道目前的情况。 我感谢任何类型的帮助。 如果需要,我可以提供更多信息。