Flutter 当我使用trailing with new column时,底部的RenderFlex溢出了40个像素
我正在使用trailing with new column在购物车中上下放置两个箭头。 这样做我面临一个问题。 我将发布我的代码。 进口“包装:颤振/材料.省道”Flutter 当我使用trailing with new column时,底部的RenderFlex溢出了40个像素,flutter,dart,Flutter,Dart,我正在使用trailing with new column在购物车中上下放置两个箭头。 这样做我面临一个问题。 我将发布我的代码。 进口“包装:颤振/材料.省道” class Cart_products extends StatefulWidget { @override _Cart_productsState createState() => _Cart_productsState(); } class _Cart_productsState extends State<
class Cart_products extends StatefulWidget {
@override
_Cart_productsState createState() => _Cart_productsState();
}
class _Cart_productsState extends State<Cart_products> {
var products_on_the_carts = [
{
"name": "Blazer",
"picture": "images/products/blazer.jpg",
"price": 80,
"size": "M",
"color": "black",
"quantity": 1,
},
{
"name": "Shoes",
"picture": "images/products/hills1.jpeg",
"price": 100,
"size": "38",
"color": "red",
"quantity": 1,
},
];
@override
Widget build(BuildContext context) {
return new ListView.builder(
itemCount: products_on_the_carts.length,
itemBuilder: (context, index) {
return new Single_cart_products(
cart_product_name: products_on_the_carts[index]["name"],
cart_product_color: products_on_the_carts[index]["color"],
cart_product_quantity: products_on_the_carts[index]["quantity"],
cart_product_size: products_on_the_carts[index]["size"],
cart_product_price: products_on_the_carts[index]["price"],
cart_product_picture: products_on_the_carts[index]["picture"],
);
});
}
}
class Single_cart_products extends StatelessWidget {
final cart_product_name;
final cart_product_picture;
final cart_product_price;
final cart_product_size;
final cart_product_color;
final cart_product_quantity;
Single_cart_products({
this.cart_product_name,
this.cart_product_picture,
this.cart_product_price,
this.cart_product_size,
this.cart_product_color,
this.cart_product_quantity
});
@override
Widget build(BuildContext context) {
return Card(
child: ListTile(
leading: new Image.asset(cart_product_picture),
title: new Text(cart_product_name),
subtitle: new Column(
children: <Widget>[
new Row(
children: <Widget>[
// product size
Padding(
padding: const EdgeInsets.all(0.0),
child: new Text("Size:"),
),
Padding(
padding: const EdgeInsets.all(0.0),
child: new Text(cart_product_size, style: TextStyle(color:Colors.red),),
),
// product color
new Padding(padding: const EdgeInsets.fromLTRB(20.0, 8.0, 8.0, 8.0),
child: new Text("Color:"),),
Padding(
padding: const EdgeInsets.all(0.0),
child: new Text(cart_product_color, style: TextStyle(color:Colors.red),),
),
],
),
// product price
new Container(
alignment: Alignment.topLeft,
child: new Text("\$${cart_product_price}", style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold, color:
class Cart\u产品扩展了StatefulWidget{
@凌驾
_购物车\产品状态createState()=>\购物车\产品状态();
}
类\u购物车\u产品状态扩展状态{
推车上的var产品=[
{
“名称”:“Blazer”,
“图片”:“images/products/blazer.jpg”,
“价格”:80,
“尺寸”:“M”,
“颜色”:“黑色”,
“数量”:1,
},
{
“名称”:“鞋子”,
“图片”:“图像/产品/hills1.jpeg”,
“价格”:100,
“尺寸”:“38”,
“颜色”:“红色”,
“数量”:1,
},
];
@凌驾
小部件构建(构建上下文){
返回新的ListView.builder(
itemCount:推车上的产品长度,
itemBuilder:(上下文,索引){
退回新的单车产品(
购物车产品名称:购物车上的产品[索引][“名称”],
购物车产品颜色:购物车上的产品[索引][“颜色”],
购物车产品数量:购物车上的产品[索引][“数量”],
购物车产品尺寸:购物车上的产品[索引][“尺寸”],
购物车产品价格:购物车上的产品[指数][“价格”],
购物车产品图片:购物车上的产品[索引][“图片”],
);
});
}
}
类单车产品{
最终购物车产品名称;
最终购物车产品图片;
最终购物车产品价格;
最终购物车产品尺寸;
最终产品颜色;
最终购物车产品数量;
单车产品({
此.cart\u产品\u名称,
这个.cart\u产品\u图片,
此.cart\u产品\u价格,
此.cart\u产品\u尺寸,
此.cart\u产品\u颜色,
这是购物车\产品\数量
});
@凌驾
小部件构建(构建上下文){
回程卡(
孩子:ListTile(
领先:新形象。资产(购物车、产品、图片),
标题:新文本(购物车产品名称),
副标题:新专栏(
儿童:[
新行(
儿童:[
//产品尺寸
填充物(
填充:常量边集全部(0.0),
子项:新文本(“大小:”),
),
填充物(
填充:常量边集全部(0.0),
子项:新文本(购物车\产品\大小,样式:文本样式(颜色:Colors.red)),
),
//产品颜色
新填充(填充:从LTRB(20.0,8.0,8.0,8.0,8.0)开始的常量边缘集),
子项:新文本(“颜色:”,),
填充物(
填充:常量边集全部(0.0),
子项:新文本(购物车、产品、颜色、样式:文本样式(颜色:Colors.red)),
),
],
),
//产品价格
新容器(
对齐:alignment.topLeft,
子项:新文本(\${cart\u product\u price}),样式:TextStyle(fontSize:16.0,fontWeight:fontWeight.bold,颜色:
颜色(红色),,
)
],
),
尾随:新列(
儿童:[
新图标按钮(图标:图标(图标。箭头下拉),按下:({}),
//新文本($cart\U product\U size”),
新图标按钮(图标:图标(图标。箭头下拉),按下:({}),
],
),
),
);
}
}