我想在警报对话框中显示项目列表,以确认付款。但它不起作用,我尝试了很多解决方案。
AlertDialog( titlePadding: EdgeInsets.all(0), contentPadding: EdgeInsets.symmetric(horizontal: 10, vertical: 0), title: Text("Heading"), content: ListView.builder( shrinkWrap: true, itemCount: items.length, itemBuilder: (ctx, i) { return getRowWidget(i); }), );
问问题
367 次
2 回答
0
这将解决您的问题,添加Container
宽度。
showDialog(
context: context,
builder: (context) => AlertDialog(
titlePadding: EdgeInsets.all(0),
contentPadding: EdgeInsets.symmetric(horizontal: 10, vertical: 0),
title: Text("Heading"),
content: Container(
width: double.maxFinite,
child: ListView.builder(
shrinkWrap: true,
itemCount: items.length,
itemBuilder: (ctx, i) {
return Text(items[i].toString());
}),
),
),
);
于 2020-09-08T10:58:47.857 回答
0
使用此代码。
showDialog(
context: context,
builder: (context) => AlertDialog(
titlePadding: EdgeInsets.all(0),
contentPadding:
EdgeInsets.symmetric(horizontal: 10, vertical: 0),
title: Text("Heading"),
content: Container(
height: 100,
child: ListView.builder(
shrinkWrap: true,
itemCount: 1,
itemBuilder: (ctx, i) {
return Text("text");
}),
),
),
);
于 2020-09-08T11:44:05.433 回答