我使用带新列的尾随在购物车中上下放置两个箭头。我在做这件事时遇到了一个问题。我会发布我的代码
导入‘package:flutter/material.dart’;
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:
Colors.red(、(,)],),拖尾:新建列(儿童:[新图标按钮(icon:icon(Icons.arrow_drop_up(,onPressed:(({}(,//新文本("$cart_product_size"(,新图标按钮(icon:icon(Icons.arrow_drop_down(,onPressed:(({}(,],),),);}}
trailing: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Expanded(
child: IconButton(
padding: EdgeInsets.zero,
icon: Icon(Icons.arrow_drop_up),
onPressed: () {},
),
),
Expanded(child: Text("$cart_prod_qty")),
Expanded(
child: IconButton(
padding: EdgeInsets.zero,
icon: Icon(Icons.arrow_drop_down),
onPressed: () {},
),
),
],
),