繁体   English   中英

A RenderFlex 在底部溢出 128 像素

[英]A RenderFlex overflowed by 128 pixels on the bottom

在此处输入图片说明

The relevant error-causing widget was: 
  Column file:///F:/App/Market/1.7/flutter_application/lib/src/pages/cart.dart:71:21
The overflowing RenderFlex has an orientation of Axis.vertical.
The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and black striped pattern. This is usually caused by the contents being too big for the RenderFlex.

Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the RenderFlex to fit within the available space instead of being sized to their natural size.
This is considered an error condition because it indicates that there is content that cannot be seen. If the content is legitimately bigger than the available space, consider clipping it with a ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex, like a ListView.

The specific RenderFlex in question is: RenderFlex#22d62 relayoutBoundary=up3 OVERFLOWING
...  needs compositing
...  parentData: not positioned; offset=Offset(0.0, 0.0) (can use size)
...  constraints: BoxConstraints(0.0<=w<=411.4, 0.0<=h<=403.4)
...  size: Size(411.4, 403.4)
...  direction: vertical
...  mainAxisAlignment: start
...  mainAxisSize: max
...  crossAxisAlignment: center
...  verticalDirection: down
◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
════════════════════════════════════════════════════════════════════════════════════════════════════

 body: RefreshIndicator( onRefresh: _con.refreshCarts, child: _con.carts.isEmpty ? EmptyCartWidget() : Stack( alignment: AlignmentDirectional.bottomCenter, children: [ Column( children: <Widget>[ Padding( padding: const EdgeInsets.only(left: 20, right: 10), child: ListTile( contentPadding: EdgeInsets.symmetric(vertical: 0), leading: Icon( Icons.shopping_cart, color: Theme.of(context).hintColor, ), title: Text( S.of(context).shopping_cart, maxLines: 1, overflow: TextOverflow.ellipsis, style: Theme.of(context).textTheme.headline4, ), subtitle: Text( S .of(context) .verify_your_quantity_and_click_checkout, maxLines: 1, overflow: TextOverflow.ellipsis, style: Theme.of(context).textTheme.caption, ), ), ), ListView.separated( padding: EdgeInsets.symmetric(vertical: 15), scrollDirection: Axis.vertical, shrinkWrap: true, primary: true, itemCount: _con.carts.length, separatorBuilder: (context, index) { return SizedBox(height: 15); }, itemBuilder: (context, index) { return CartItemWidget( cart: _con.carts.elementAt(index), heroTag: 'cart', increment: () { _con.incrementQuantity( _con.carts.elementAt(index)); }, decrement: () { _con.decrementQuantity( _con.carts.elementAt(index)); }, onDismissed: () { _con.removeFromCart( _con.carts.elementAt(index)); }, ); }, ), ], ), Container( padding: const EdgeInsets.all(18), margin: EdgeInsets.only(bottom: 15), decoration: BoxDecoration( color: Theme.of(context).primaryColor, borderRadius: BorderRadius.all(Radius.circular(20)), boxShadow: [ BoxShadow( color: Theme.of(context) .focusColor .withOpacity(0.15), offset: Offset(0, 2), blurRadius: 5.0) ]), child: TextField( keyboardType: TextInputType.text, onSubmitted: (String value) { _con.doApplyCoupon(value); }, cursorColor: Theme.of(context).accentColor, controller: TextEditingController() ..text = coupon?.code ?? '', decoration: InputDecoration( contentPadding: EdgeInsets.symmetric( horizontal: 20, vertical: 15), floatingLabelBehavior: FloatingLabelBehavior.always, hintStyle: Theme.of(context).textTheme.bodyText1, suffixText: coupon?.valid == null ? '' : (coupon.valid ? S.of(context).validCouponCode : S.of(context).invalidCouponCode), suffixStyle: Theme.of(context) .textTheme .caption .merge( TextStyle(color: _con.getCouponIconColor())), suffixIcon: Padding( padding: const EdgeInsets.symmetric(horizontal: 15), child: Icon( Icons.confirmation_number, color: _con.getCouponIconColor(), size: 28, ), ), hintText: S.of(context).haveCouponCode, border: OutlineInputBorder( borderRadius: BorderRadius.circular(30), borderSide: BorderSide( color: Theme.of(context) .focusColor .withOpacity(0.2))), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(30), borderSide: BorderSide( color: Theme.of(context) .focusColor .withOpacity(0.5))), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(30), borderSide: BorderSide( color: Theme.of(context) .focusColor .withOpacity(0.2))), ), ), ), ], ), ),

像这样用 Expanded 小部件包裹您的列子项。

  Column(
                      children: <Widget>[

                        Expanded(
                        child : 
                        Padding(
                          padding: const EdgeInsets.only(left: 20, right: 10),
                          child: ListTile(
                            contentPadding: EdgeInsets.symmetric(vertical: 0),
                            leading: Icon(
                              Icons.shopping_cart,
                              color: Theme.of(context).hintColor,
                            ),
                            title: Text(
                              S.of(context).shopping_cart,
                              maxLines: 1,
                              overflow: TextOverflow.ellipsis,
                              style: Theme.of(context).textTheme.headline4,
                            ),
                            subtitle: Text(
                              S
                                  .of(context)
                                  .verify_your_quantity_and_click_checkout,
                              maxLines: 1,
                              overflow: TextOverflow.ellipsis,
                              style: Theme.of(context).textTheme.caption,
                            ),
                          ),
                        )),


                        Expanded(
                        child : 
                        ListView.separated(
                          padding: EdgeInsets.symmetric(vertical: 15),
                          scrollDirection: Axis.vertical,
                          shrinkWrap: true,
                          primary: true,
                          itemCount: _con.carts.length,
                          separatorBuilder: (context, index) {
                            return SizedBox(height: 15);
                          },
                          itemBuilder: (context, index) {
                            return CartItemWidget(
                              cart: _con.carts.elementAt(index),
                              heroTag: 'cart',
                              increment: () {
                                _con.incrementQuantity(
                                    _con.carts.elementAt(index));
                              },
                              decrement: () {
                                _con.decrementQuantity(
                                    _con.carts.elementAt(index));
                              },
                              onDismissed: () {
                                _con.removeFromCart(
                                    _con.carts.elementAt(index));
                              },
                            );
                          },
                        )),
                      ],
                    )

在此处输入图片说明问题已解决,但又出现了另一个问题 有一个空位无法再按

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM