Renderflex溢出

时间:2019-06-19 10:40:41

标签: flutter dart

我正在构建一个购物应用程序。我有一个购物车页面,其中每个项目都是一个列表图块,并添加了标题,副标题,当我在结尾部分添加一列时,我将面临renderflex溢出。我只想添加2个iconbutton和一个文本来更改数量

class SingleCartProduct extends StatelessWidget {

  final singleProductCartName;
  final singleProductCartPrice;
  final singleProductCartSize;
  final singleProductCartColor;
  final singleProductCartQuantity;
  final singleProductCartPicture;

  SingleCartProduct({
      this.singleProductCartColor,
    this.singleProductCartName,
    this.singleProductCartPicture,
    this.singleProductCartPrice,
    this.singleProductCartQuantity,
    this.singleProductCartSize
  });


  @override
  Widget build(BuildContext context) {
    return Card(
      child: new ListTile(
        contentPadding: const EdgeInsets.all(8.0),
        leading: Container(
          height: 100.0,
          width: 80.0,
          child: new Image.asset(
              singleProductCartPicture,
            fit: BoxFit.fill,
          ),
        ),
        title: new Text(singleProductCartName),
        subtitle: new Column(
          children: <Widget>[
            new Row(
              children: <Widget>[
                Padding(
                  padding: const EdgeInsets.all(0.0),
                  child: new Text("Size:"),
                ),
                Padding(
                  padding: const EdgeInsets.all(4.0),
                  child: new Text(
                      singleProductCartSize,
                      style: new TextStyle(
                        color: Colors.blue,
                      ),
                  ),
                ),



                new Padding(
                    padding: const EdgeInsets.fromLTRB(20.0, 8.0, 2.0, 8.0),
                    child: new Text("Color:"),
                ),
                Padding(
                  padding: const EdgeInsets.all(2.0),
                  child: new Text(
                      singleProductCartColor,
                      style: new TextStyle(
                        color: Colors.blue
                      ),
                  ),
                ),
              ],
            ),


            Container(
              child: new Text(
                "Rs "+singleProductCartPrice.toString(),
                style: new TextStyle(
                    fontWeight: FontWeight.bold,
                    fontSize: 16.0,
                    color: Colors.blue
                ),
              ),
              alignment: Alignment.topLeft,
            )

          ],
        ),

        trailing: new Column(
          children: <Widget>[
            new IconButton(icon: Icon(Icons.arrow_drop_up), onPressed: (){},),
            //new Text(singleProductCartQuantity.toString()),
            new IconButton(icon: Icon(Icons.arrow_drop_down), onPressed: (){})
          ],
        ),
      ),
    );
  }
}

我在结尾处出现renderflex溢出。如果我删除尾随应用程序,则效果很好

0 个答案:

没有答案