问题:RenderFlex在底部溢出了187个像素

时间:2019-07-15 15:14:24

标签: flutter

我使用FlutterTagging并在其中输入时,出现以下错误:

  

底部溢出187个像素

我已经在resizeToAvoidBottomPadding: falseScaffold内部有一个SingleChildScrollView

@override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      resizeToAvoidBottomPadding: false,
      backgroundColor: Colors.white,
      body: Stack(
        children: <Widget>[
          Background(),
          SingleChildScrollView(
              child: Container(
                width: MediaQuery.of(context).size.width,
                height: (MediaQuery.of(context).size.height >= 700.0)
                    ? MediaQuery.of(context).size.height
                    : 700.0,
                child: Column(
                  children: <Widget>[
                    PaddingWith(
                      top: 70.0,
                      widget: Image(
                        image: logoSeul,
                        height: 75.0,
                      ),
                    ),
                    PaddingWith(
                      top: 50.0,
                      widget: TagSkill(),
                    ),
                    PaddingWith(
                      top: 60.0,
                      widget: TagCuriositie(),
                    )
                  ],
                ),
              ),
            ),
        ],
      ),
    );
  }

//TagSkill()

@override
  Widget build(BuildContext context) {
    // TODO: implement build
    return new SingleChildScrollView(
      child: new Container(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            //Champs Skill
            new Container(
              width: 250.0,
              child: new Column(

                children: <Widget>[
                  Padding(padding: EdgeInsets.all(0.5)),
                  FlutterTagging(
                    textFieldDecoration: InputDecoration(
                        enabledBorder: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(10.0),
                          borderSide: BorderSide(color: Colors.orange[200], width: 2.5, style: BorderStyle.solid)
                        ),
                        focusedBorder: OutlineInputBorder(
                          borderSide: BorderSide(color: Colors.orange[200], width: 2.5, style: BorderStyle.solid),
                          borderRadius: BorderRadius.circular(10.0)
                        ),
                        hintText: "Skills",
                        filled: true,
                        fillColor: Colors.white,
                        labelText: "Skills",
                      labelStyle: TextStyle(color: pointer),

                    ),
                    //Appel d'une fonction pour afficher le bouton Add New Skill
                    addButtonWidget: _buildAddButtonSkill(),
                    chipsColor: Colors.blue[300],
                    chipsFontColor: Colors.white,
                    deleteIcon: Icon(Icons.cancel, color: Colors.white),
                    chipsPadding: EdgeInsets.all(2.0),
                    chipsFontSize: 14.0,
                    chipsSpacing: 5.0,
                    suggestionsCallback: (pattern) async {
                      //Appel la class TagSearchServiceSkill pour la suggestion de Skill déjà enregistrés
                      return await TagSearchServiceSkill.getSuggestions(
                          pattern);
                    },
                    onChanged: (result) {
                      setState(() {
                        if(_controllerSkill != null && _controllerSkill != ""){
                          _controllerSkill = result;
                        }
                      });
                    },
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }

The following assertion was thrown during layout:
I/flutter ( 8922): A RenderFlex overflowed by 187 pixels on the bottom.
I/flutter ( 8922): 
I/flutter ( 8922): The overflowing RenderFlex has an orientation of Axis.vertical.
I/flutter ( 8922): The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and
I/flutter ( 8922): black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
I/flutter ( 8922): Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the
I/flutter ( 8922): RenderFlex to fit within the available space instead of being sized to their natural size.
I/flutter ( 8922): This is considered an error condition because it indicates that there is content that cannot be
I/flutter ( 8922): seen. If the content is legitimately bigger than the available space, consider clipping it with a
I/flutter ( 8922): ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex,
I/flutter ( 8922): like a ListView.
I/flutter ( 8922): The specific RenderFlex in question is: RenderFlex#06b54 relayoutBoundary=up12 OVERFLOWING:
I/flutter ( 8922):   needs compositing
I/flutter ( 8922):   creator: Column ← MediaQuery ← LayoutId-[<_ScaffoldSlot.body>] ← CustomMultiChildLayout ←
I/flutter ( 8922):     AnimatedBuilder ← DefaultTextStyle ← AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#7f655 ink
I/flutter ( 8922):     renderer] ← NotificationListener<LayoutChangedNotification> ← PhysicalModel ←
I/flutter ( 8922):     AnimatedPhysicalModel ← Material ← ⋯
I/flutter ( 8922):   parentData: offset=Offset(0.0, 0.0); id=_ScaffoldSlot.body (can use size)
I/flutter ( 8922):   constraints: BoxConstraints(0.0<=w<=360.0, 0.0<=h<=349.0)
I/flutter ( 8922):   size: Size(360.0, 349.0)
I/flutter ( 8922):   direction: vertical
I/flutter ( 8922):   mainAxisAlignment: start
I/flutter ( 8922):   mainAxisSize: max
I/flutter ( 8922):   crossAxisAlignment: center
I/flutter ( 8922):   verticalDirection: down
I/flutter ( 8922): 

1 个答案:

答案 0 :(得分:0)

将代码放入容器中,然后重试。

    Scaffold(
          body: new Container(
                      height: double.infinity,
                      width: double.infinity,
                      child: yourWidget(),
                    )
           //....