Дно переполнено на 82 пикселя во флаттере - PullRequest
0 голосов
/ 27 февраля 2020

Я получаю переполнение дна на 82 пикселя исключение в нижней части экрана регистрации. пробовал с resizeToAvoidBottomPadding: false но он не работает. Я интегрирую модуль флаттера в существующее приложение android. вызывая трепетание внутри деятельности. в зависимости от высоты экрана он покрывает кнопку или текст. и иногда это показывает основание, переполненное на 7 пикселей. он меняется в зависимости от высоты экрана. Flutter

Вот код:

@override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
        //resizeToAvoidBottomPadding : false,
        key: _scaffoldKey,
        body: SingleChildScrollView(
          child: SafeArea(
              child: Container(
                  height: SizeConfig.blockSizeVertical * 100,
                  width: SizeConfig.blockSizeHorizontal * 100,
                  decoration: BoxDecoration(
                      color: Color(0xffF44336)
                  ),
                  child:Stack(
                    children: <Widget>[
                      Hero(
                        tag: 'signupTag',
                        child: Container(
                            height: SizeConfig.blockSizeVertical * 30,
                            width: SizeConfig.blockSizeHorizontal * 100,
                            alignment: Alignment.center,
                            child: Text('Sign up', style: TextStyle(fontFamily:'Montserrat', fontSize: 50.0, color: Colors.white))
                        ),
                      ),
                      Positioned(
                        bottom: 0.0,
                        child: Container(
                          padding: EdgeInsets.only(top:70.0, left: 50.0, right:50.0),
                            height: SizeConfig.blockSizeVertical * 75,
                            width: SizeConfig.blockSizeHorizontal * 100,
                            decoration: BoxDecoration(
                                color: Colors.white,
                                borderRadius: BorderRadius.only(topLeft: Radius.circular(45.0), topRight: Radius.circular(45.0))
                            ),
                            child: Column(
                              children: <Widget>[
                                Container(
                                  alignment: Alignment.centerLeft,
                                  child:Text('Welcome', style:TextStyle(fontSize:30.0, fontWeight: FontWeight.bold, fontFamily: 'Montserrat', color: Color(0xff424242)),),
                                ),
                                Container(
                                  margin: EdgeInsets.only(bottom:20.0),
                                  alignment: Alignment.centerLeft,
                                  child:Text('Create an account to continue', style:TextStyle(fontSize:16.0, fontWeight: FontWeight.bold, fontFamily: 'Montserrat', color: Color(0xff707475)),),
                                ),
                                TextField(
                                  controller: nameController,
                                  style: TextStyle(fontSize:17.0),
                                  decoration: InputDecoration(
                                    contentPadding: EdgeInsets.fromLTRB(0.0, 15.0, 0.0, 15.0),
                                    hintText: "Full Name",
                                    focusedBorder: UnderlineInputBorder(
                                      borderSide: BorderSide(color: Color(0xffff992b), width: 2.0)
                                    )
                                  ),
                                ),
                                SizedBox(
                                  height: 25.0,
                                ),
                                TextField(
                                  controller: emailController,
                                  style: TextStyle(fontSize:17.0),
                                  decoration: InputDecoration(
                                      contentPadding: EdgeInsets.fromLTRB(0.0, 15.0, 0.0, 15.0),
                                      hintText: "Email",
                                      focusedBorder: UnderlineInputBorder(
                                          borderSide: BorderSide(color: Color(0xffff992b), width: 2.0)
                                      )
                                  ),
                                ),
                                SizedBox(
                                  height: 25.0,
                                ),
                                TextField(
                                  obscureText: true,
                                  controller: passwordController,
                                  style: TextStyle(fontSize:17.0),
                                  autocorrect: false,
                                  decoration: InputDecoration(
                                      contentPadding: EdgeInsets.fromLTRB(0.0, 15.0, 0.0, 15.0),
                                      hintText: "Password",
                                      focusedBorder: UnderlineInputBorder(
                                          borderSide: BorderSide(color: Color(0xffff992b), width: 2.0)
                                      )
                                  ),
                                ),
                                SizedBox(
                                  height: 40.0,
                                ),
                                Stack(
                                  children: <Widget>[
                                    Positioned.fill(
                                      child: Container(
                                        margin: EdgeInsets.symmetric(horizontal: 20.0),
                                        decoration: BoxDecoration(
                                          borderRadius: BorderRadius.all(Radius.circular(32.0)),
                                          boxShadow: [
                                            BoxShadow(
                                              offset: Offset(0.0, 15.0),
                                              blurRadius: 15.0,
                                              color: Color(0xffBDBDBD),
                                              spreadRadius: 2.0
                                            )
                                          ]
                                        )
                                      )
                                    ),
                                    Material(
//                                  elevation: 5.0,
                                      borderRadius: BorderRadius.circular(30.0),
                                      color: Color(0xffF44336),
                                      child: MaterialButton(
                                          minWidth: MediaQuery.of(context).size.width,
                                          padding: EdgeInsets.all(20.0),
                                          onPressed: () {
                                            signup().then((res){
                                              if(res['status'] == 'Success'){
                                                Navigator.push(
                                                  context,
                                                  MaterialPageRoute(builder: (context) => LoginPage()),
                                                );
                                              } else {
                                                _displaySnackBar(context, res['comments']);
                                              }

                                            });
                                          },
                                          child: Text("CREATE",
                                            textAlign: TextAlign.center,
                                            style: TextStyle(color: Colors.white, fontSize:15.0, letterSpacing: 1.5),
                                          )
                                      ),
                                    ),
                                  ],
                                ),

                                SizedBox(
                                  height: 30.0,
                                ),
                                Row(
                                  mainAxisAlignment: MainAxisAlignment.center,
                                  children: <Widget>[
                                    Text("Already have an account?", style:TextStyle(fontSize: 16.0)),
                                    Hero(
                                      tag: 'loginTag',
                                      child:FlatButton(
                                          onPressed: () {
                                            Navigator.push(
                                              context,
                                              MaterialPageRoute(builder: (context) => LoginPage()),
                                            );
                                          },
                                          child: Text('Sign in', style:TextStyle(fontSize: 18.0, color: Color(0xffF44336)))
                                      )
                                    )
                                  ],
                                )
                              ],
                            )
                        ),
                      )
                    ],
                  )
              )
          )
        )
    );
  }
}

1 Ответ

2 голосов
/ 27 февраля 2020

Иерархия должна быть:

body: SafeArea
        - SingleChildScrollView
           -Container(remove height)
...