簡體   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