Flutter:My ScrollWidget 正在向下滚动,但我的提交和取消凸起按钮变得不可见或未显示

Flutter:My ScrollWidget is scrolling down but my SUBMIT and CANCEL Raised Buttons are getting invisible or not shown

错误显示是

Invalid Matrix

我想要我的提交按钮和取消按钮,因为这是 flutter 中的表单提交 我的 ScrollWidget 正在向下滚动,但我的 SUBMIT 和 CANCEL Raised Buttons 变得不可见或不显示。 代码如下:

   body: SingleChildScrollView(
              child: Column(
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[
              SizedBox(
                height: 20.0,
              ),
                 Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: <Widget>[
                  Expanded(
                    flex: 1,
                    child: Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: TextField(
                        autofocus: false,
                        decoration: InputDecoration(
                          prefixIcon: Icon(Icons.person_pin),
                          labelText: 'CompanyName',
                          hintText: 'Type the company Name',
                        ),
                      ),
                    ),
                  ),
                  Expanded(
                    flex: 1,
                    child: Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: TextField(
                         autofocus: false,
                        decoration: InputDecoration(
                          prefixIcon: Icon(Icons.phone_android),
                          labelText: 'ModelName',
                          hintText: 'Type the Model Name',
                        ),
                      ),
                    ),
                  ),
                ],
              ),
                
              Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: <Widget>[
                  Expanded(
                    flex: 1,
                    child: Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: TextField(
                          keyboardType: TextInputType.number,
                        inputFormatters: [
                          WhitelistingTextInputFormatter.digitsOnly
                        ],
                        decoration: InputDecoration(
                          labelText: 'SerielNumber',
                          hintText: 'Type the Seriel Number',
                          prefixIcon: Icon(Icons.view_headline),
                        ),
                      ),
                    ),
                  ),

              Row(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: <Widget>[
                  RaisedButton(
                    color: Color(0xff476cfb),
                    onPressed: () {
                      Navigator.of(context).pop();
                    },
                    elevation: 4.0,
                    splashColor: Colors.blueGrey,
                        child: TextField(
                      maxLines: null,
                      autofocus: false,
                      decoration: InputDecoration(
                          prefixIcon: Icon(Icons.place),
                          labelText: 'Cancel',

                      ),
                    ),
             
                 
                  ),
                  RaisedButton(
                    color: Color(0xff476cfb),
                    onPressed: () {
                      uploadPic(context);
                    },

                    elevation: 4.0,
                    splashColor: Colors.blueGrey,
                    
                    child: TextField(
                      maxLines: null,
                      autofocus: false,
                      decoration: InputDecoration(
                        prefixIcon: Icon(Icons.place),
                        labelText: 'Submit',

                      ),
                    ),
                                       
                  ),

                ],
              )

            ],
        ),
      ),
    );
  }
}

问题出在您的 RaisedButton 的 Child 上。 TextField 必须具有有界宽度。 您可以使用 Text 小部件或 Container 小部件作为 RaisedButton 的 child 并使用 Row 作为 Container 的 child 来设置标题和图标,如下代码所示:

RaisedButton(
                  color: Color(0xff476cfb),
                  onPressed: () {
                    Navigator.of(context).pop();
                  },
                  elevation: 4.0,
                  splashColor: Colors.blueGrey,
                  child: Container(
                      child: Row(
                    children: [
                      Text('submit'),
                      Icon(Icons.place),
                    ],
                  )),
                ),