SingleChildScrollView 不可滚动

时间:2020-12-19 09:23:53

标签: flutter

我正在尝试为页面添加 SingleChildScrollView 但它似乎不起作用,无法找出原因。我没有收到任何溢出错误,但屏幕上看不到 Fitbutton。我尝试在网上搜索,但没有找到任何相关的解决方案。 这是我试过的代码片段:

return Scaffold(
        body:SingleChildScrollView(
          child: Form(
                key:_formKey,
                child: Padding(
                  padding: const EdgeInsets.all(0.0),
                  child: Stack(
                    children: <Widget>[
                      Container(
                          decoration:( ...
                           ),
                          )
                      ),
                      Positioned(
                          
                          top: MediaQuery.of(context).size.width * 0.10,
                          child: Container(
                            margin: EdgeInsets.all(13.0),
                            child:Column(
                                mainAxisAlignment: MainAxisAlignment.center,
                                children: <Widget>[
                                  Text("Welcome",style: TextStyle(fontWeight: FontWeight.bold,fontSize: 25.0),),
                                  SizedBox(
                                    height: 22,
                                  ),
                                  Stack(
                                    alignment: Alignment.centerLeft,
                                    children: [
                                      Container(
                                        height:60.0,
                                        padding: EdgeInsets.only(left: 53.0),
                                        child: buildNameField()
                                      ),
                                      CircleAvatar(
                                        ...
                                      ),
                                    ],
                                  ),
                                  SizedBox(
                                    height: 22.0,
                                  ),
                                  Stack(
                                    alignment: Alignment.centerLeft,
                                    children: [
                                      .....
                                    ],
                                  ),
                                  SizedBox(
                                    height: 10,
                                  ),
                                  Stack(
                                    alignment: Alignment.centerLeft,
                                    children: [
                                      ...
                                    ],
                                  ),
                                  
                                  SizedBox(height: 22),
                                  FitButton(
                                    ....
                                  ),
                                  Padding(
                                    padding: const EdgeInsets.only(top: 16),
                                    child: _buildSignInButton(),
                                  ),
                                ]
                            ),
                          ),
                      ),],
                  ),
                ),
              ),),
     );

任何帮助都会很棒!!

2 个答案:

答案 0 :(得分:0)

从 Form 中移除 SingleChildScrollView 并 Wrap to Column 可以解决。

答案 1 :(得分:0)

尝试将 form 包裹在 sizedBox 中,然后将 sizedBox 包裹在 SingleChildScrollView