ListView.builder底部由抖动中的像素溢出 [英] ListView.builder bottom overflow by pixel in flutter

查看:141
本文介绍了ListView.builder底部由抖动中的像素溢出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是我使用 ListView.builder 的方式,它在中与<$ c $一起使用c>扩展小部件。我尝试了一些解决方案,但它们不起作用,这是一个动态列表。

This is how I'm using ListView.builder and it is taken in Column with Expanded widgets. I have tried some solution but they are not working and this is a dynamic list.

return Container(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        mainAxisSize: MainAxisSize.max,
        children: <Widget>[
          headingContainer(width,order_response),
          Expanded(
            child:  ListView.builder(
              shrinkWrap: true,
              controller: _scrollController,
              itemCount:order_response.orderDetails.length,
              itemBuilder: (context, position) {return orderListItemTile(width,height,order_response,position);},
            ),
          ),

        ],
      ),
    );


这是我的商品

This is my item Widget

 Column orderListItemTile(double width,double height, Order order_response, int position){
      return Column(
        children: <Widget>[
          GestureDetector(
            onTap: (){
              Navigator.push(
                context,
                new MaterialPageRoute(builder: (context) => new OrderDetails(payload:order_response.orderDetails[position].orderRowId)),
              );
            },
            child: new  Container(
            decoration: BoxDecoration(color: MyColors.backgroundColor),
            padding: EdgeInsets.only(left:width*0.05,right: width*0.05,top:width*0.03,bottom: width*0.03),
            child: new Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Text(order_response.orderDetails[position].orderDateTime,style: TextStyle(color: Colors.grey,fontSize: 14.0,fontWeight: FontWeight.w800)),
                SizedBox(height: height*0.01),
                new Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: <Widget>[
                    Text(order_response.orderDetails[position].productName,style: TextStyle(color: MyColors.colorPrimaryDark,fontSize: 18.0,fontWeight: FontWeight.w700)),
                    SizedBox(
                      height: 26.0,
                      width: 26.0,
                      child: RawMaterialButton(
                        onPressed: () {

                        },
                        child: new Icon(
                          Icons.arrow_forward_ios,
                          color: Colors.white,
                          size: 16.0,
                        ),
                        shape: new CircleBorder(),
                        elevation: 2.0,
                        fillColor: Colors.grey[400],
                        padding: const EdgeInsets.all(5.0),
                      ),
                    ),
                  ],
                ),
                SizedBox(height: height*0.01),
                Text(order_response.orderDetails[position].customerName,style: TextStyle(color: Colors.grey,fontSize: 14.0,fontWeight: FontWeight.w800)),
              ],
            ),
          ),),
          Container(
            decoration: BoxDecoration(color: Colors.grey[350]),
            padding: EdgeInsets.only(left:width*0.05,right: width*0.05),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: <Widget>[
                Row(
                  children: <Widget>[
                    SizedBox(
                        height: 36.0,
                        width: 36.0,
                        child: IconButton(
                            padding: EdgeInsets.only(top:4.0,bottom: 4.0),
                            icon: Image.asset(order_response.orderDetails[position].orderStatus.contains('accepted')?'assets/images/right.png':'assets/images/wrong.png'),
                            onPressed: (){Navigator.pop(context,true);}
                        )),
                    SizedBox(
                        height: 36.0,
                        width: 36.0,
                        child: IconButton(
                            padding: EdgeInsets.only(top:4.0,bottom: 4.0,left: 5.0),
                            icon: Image.asset('assets/images/cart.png'),
                            onPressed: (){Navigator.pop(context,true);}
                        )),
                  ],),
                Text('Total ${order_response.orderDetails[position].orderAmount}',style: TextStyle(color: Colors.black87,fontSize: 16.0,fontWeight: FontWeight.w700)),

              ],),)

        ],
      );
    }


推荐答案

尝试使容器已满像 height这样的高度:MediaQuery.of(context).size.height

这篇关于ListView.builder底部由抖动中的像素溢出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆