如何使用 SingleChildScrollView 避免溢出

How to avoid overflow by using SingleChildScrollView

我对 flutter 还很陌生,而且我很困在一个定位中。 有人body 知道我应该把“SingleChildScrollView”放在哪里吗?我得到堆栈溢出 148PX。 我的代码看起来像这样,我尝试了所有可能的方法,但我仍然没有设法修复它。 我不明白我应该把 body 放在哪里:

class SignUp extends StatefulWidget {
  @override
  _SignUpState createState() => _SignUpState();
}

class _SignUpState extends State<SignUp> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Container(
            alignment: Alignment.bottomCenter,
            width: 400,
            height: 350,
            decoration: BoxDecoration(
                image: DecorationImage(
                    image: ExactAssetImage('assets/images/qlogo1.png'))),
          ),
          SizedBox(height: 1),
          Container(
            alignment: Alignment.bottomCenter,
            padding: EdgeInsets.symmetric(horizontal: 40),
            child: Column(
              children: [
                TextField(
                  style: mediumTextStyle(),
                  decoration: textFieldInputDecoration('username'),
                ),
                TextField(
                  style: mediumTextStyle(),
                  decoration: textFieldInputDecoration('password'),
                ),
              ],
            ),
          ),
          SizedBox(
            height: 25,
          ),
          // creaza spatii intre containere
          Container(
            alignment: Alignment.centerRight,
            child: Container(
                padding: EdgeInsets.symmetric(horizontal: 37, vertical: 8),
                child: Text(
                  'Forgot Password?',
                  style: TextStyle(
                      color: Colors.white,
                      fontSize: 14,
                      fontFamily: 'Quicksand',
                      decoration: TextDecoration.underline),
                )),
          ),
          SizedBox(height: 24),
          Container(
            alignment: Alignment.center,
            width: MediaQuery.of(context).size.width - 70,
            padding: EdgeInsets.symmetric(vertical: 20),
            decoration: BoxDecoration(
              gradient: LinearGradient(
                  colors: [const Color(0xFFF06292), const Color(0xff2A75BC)]),
              borderRadius: BorderRadius.circular(30),
            ),
            child: Text(
              'Sign In',
              style: mediumTextStyle(),
            ),
          ),
          SizedBox(
            height: 16,
          ),
          Container(
            alignment: Alignment.center,
            width: MediaQuery.of(context).size.width - 70,
            padding: EdgeInsets.symmetric(vertical: 20),
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.circular(30),
            ),
            child: Text('Register',
                style: TextStyle(
                    color: Colors.black87,
                    fontFamily: 'Quicksand',
                    fontSize: 17)),
          ),
        ],
      ),
    );
  }
}

谢谢!

如果您希望所有屏幕都滚动 - 执行此操作:

return Scaffold(
    body: SingleChildScrollView(
        child: Column(
            // your other code
        )
    )
);