0

我对颤振很陌生,而且我非常坚持定位。有人知道我应该在哪里放置“SingleChildScrollView”吗?我得到堆栈溢出 148PX。我的代码看起来像这样,我尝试了所有可能的方式,但我仍然没有设法解决它。我不明白我应该把身体放在哪里:

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)),
          ),
        ],
      ),
    );
  }
}

谢谢!

4

1 回答 1

3

如果您希望滚动所有屏幕 - 请执行以下操作:

return Scaffold(
    body: SingleChildScrollView(
        child: Column(
            // your other code
        )
    )
);
于 2021-03-16T23:26:51.880 回答