ListView.builder bottom overflow by pixel in flutter

匿名 (未验证) 提交于 2019-12-03 01:41:02

问题:

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)),                ],),)          ],       );     } 

回答1:

Try Wrap Container with SingleChildScrollView



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!