使用SingleChildScrollView时底部的空白

时间:2020-10-29 11:46:49

标签: flutter user-interface

我想实现SingleScrollView以避免每次在窗体字段上使用键盘时出现的底部溢出问题。但是,当我添加小部件时,在底部有一个空格,我真的不知道如何解决。

我一直在积极寻找解决方案,但是我是菜鸟。

class _LoginPageState extends State<LoginPage> {
bool loading = false;
GlobalKey<FormState> loginKeyForm = new GlobalKey();
TextEditingController emailCtrl = new TextEditingController();
TextEditingController passwordCtrl = new TextEditingController();
String _error;
double screenHeight;

@override
Widget build(BuildContext context) {
screenHeight = MediaQuery.of(context).size.height;
return Scaffold(
  body: Stack(
    children: <Widget>[
      Container(
        decoration: BoxDecoration(
          gradient: LinearGradient(
            colors: [
              Color.fromRGBO(80, 255, 162, 1),
              Color.fromRGBO(199, 250, 240, 1),
            ],
          ),
        ),
        child: SafeArea(
          child: SingleChildScrollView(
            child: Column(children: [
              _topLogo(),
              SizedBox(height: screenHeight * 0.02),
              _loginForm(),
              SizedBox(height: screenHeight * 0.02),
              _socialLogins(),
              SizedBox(height: screenHeight * 0.06),
              _newAcountButton(),
            ]),
          ),
        ),
      ),
      Container(
        child: loading ? LoadingWidget() : Container(),
      ),
    ],
  ),
);
}

login page

0 个答案:

没有答案