我正在构建一个带有登录屏幕的Flutter 翼应用程序.将焦点放在文本字段上时,屏幕溢出,无法滚动.我try 过使用ListView.builder,但这只会给出一个renderBox错误,而常规的ListView不起作用

ScreenScreen on Text Input

小部件 struct 如下

-scafold
   - body
     - container
       - column    
           - form
              - column
                  - textInput
                  - textInput
                  - container    
           - container
              - row      
           - raisedButton

提前谢谢你!!

推荐答案

try 此代码:它使用ListView

    class Home extends StatelessWidget {
  @override
     Widget build(BuildContext context) {
        // TODO: implement build
        return Scaffold(
          body: Center(
            child: ListView(
              shrinkWrap: true,
              padding: EdgeInsets.all(15.0),
              children: <Widget>[
                Center(
                  child: Card(
                    elevation: 8.0,
                    child: Container(
                      padding: EdgeInsets.all(10.0),
                      child: Column(
                        children: <Widget>[
                          TextField(
                            decoration: InputDecoration(
                              prefixIcon: Icon(Icons.person),
                              labelText: "Username or Email",
                            ),
                          ),
                          SizedBox(
                            height: 15.0,
                          ),
                          TextField(
                            decoration: InputDecoration(
                              prefixIcon: Icon(Icons.lock),
                              labelText: "Password",
                            ),
                          ),
                          SizedBox(
                            height: 15.0,
                          ),
                          Material(
                            borderRadius: BorderRadius.circular(30.0),
                            //elevation: 5.0,
                            child: MaterialButton(
                              onPressed: () => {},
                              minWidth: 150.0,
                              height: 50.0,
                              color: Color(0xFF179CDF),
                              child: Text(
                                "LOGIN",
                                style: TextStyle(
                                  fontSize: 16.0,
                                  color: Colors.white,
                                ),
                              ),
                            ),
                          )
                        ],
                      ),
                    ),
                  ),
                ),
                SizedBox(
                  height: 25.0,
                ),
                Row(
                  children: <Widget>[
                    Expanded(child: Text("Don't Have a Account?")),
                    Text("Sign Up",
                        style: TextStyle(
                          color: Colors.blue,
                        )),
                  ],
                ),
              ],
            ),
          ),
          bottomNavigationBar: Padding(
            padding: EdgeInsets.all(10.0),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Expanded(
                    child: RaisedButton(
                      padding: EdgeInsets.all(15.0),
                      onPressed: () {},
                      color: Colors.white,
                      shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(
                            32.0,
                          ),
                          side: BorderSide(color: Color(0xFF179CDF))),
                      child: Text(
                        "SKIP SIGN UP FOR NOW",
                        style:
                        TextStyle(fontSize: 18.0, color: Color(0xFF179CDF)),
                      ),
                    )),
              ],
            ),
          ),
        );
      }
    }

Flutter相关问答推荐

如何更改ElevatedButton的 colored颜色 以按下它?

类型int不是可迭代动态tmdbapi类型的子类型<>

错误:找不到字体功能类型.Ffltter Google_Fonts包错误

自定义ItemBuilderFlutter

如何将 colored颜色 阴影作为默认容器 colored颜色 应用于自定义窗口小工具?

如何让两个展开的Widget根据其子窗口的屏幕大小

在flutter中实现类似3D的可滚动堆叠分页列表

带有附加图像的ListTile

如何将小部件代码移动到另一个文件以获得更好的可读性

Flutter 需要 Xcode 14 或更高版本

ScaffoldMessenger 在等待键下方不起作用

为 flutter app/firebase 保存 chatgpt api-key 的正确方法是什么

更改下拉按钮的背景 colored颜色 - flutter

Flutter 应用程序在启动画面冻结(java.lang.RuntimeException:无法启动活动 ComponentInfo)

我的第一个 flutter 项目出错,启动时为空值?

如何在 Flutter 中将 ScaffoldMessenger 中的 Snackbar 显示为 Widget?

为什么 orientation == Orientation.portrait 总是正确的,尽管我的设备已经处于横向

主题:ThemeData() Flutter

带有 Dismissible 和 Provider (NotifyListener) 的笨拙动画

如何将 pushNamed 与 Dismissible Widget 一起使用并查看背景透明第一页