Bottom overloaded by 213 pixels in flutter

前端 未结 14 810
面向向阳花
面向向阳花 2021-02-01 02:04

Hi I am trying to create login screen. It is working fine for me. When I open the keyboard then it is giving me an error Bottom overloaded by 213 pixels.

         


        
相关标签:
14条回答
  • wrap your child view into ListView will solve the prob. Please check this

     class _LoginScreenState extends State<LoginScreen> {
     @override
     Widget build(BuildContext context) {
        return new Scaffold(
        body: new Container(
         child: ListView(
           children: <Widget>[
            Padding(
              padding: const EdgeInsets.all(8.0),
              child: new Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
    
                    new Padding(
                      padding: EdgeInsets.only(left: 1,top: 50,right: 1,bottom: 1),
                      child: new Text("jk", style: TextStyle(fontFamily: "mono_bold")),
                    ),
    
                     new Padding(
                      padding: EdgeInsets.only(left: 1,top: 50,right: 1,bottom: 1),
                      child: new TextField(
                        style: new TextStyle(),
                          decoration: InputDecoration(
                            labelText: "Email",
                            contentPadding: EdgeInsets.all(8.0)
                        ),
                        keyboardType: TextInputType.emailAddress,
                      )
                    ),
                     new Padding(
                      padding: EdgeInsets.only(left: 1,top: 50,right: 1,bottom: 1),
                      child: new TextField(
                        style: new TextStyle(
    
                        ),
                        decoration: InputDecoration(
                          labelText: "Password"
    
                        ),
                        keyboardType: TextInputType.text,
                        obscureText: true,
                        ),
                    ),
                  ],
              ),
            ),
          ],
        )
      ),
    );
    }
    
    0 讨论(0)
  • 2021-02-01 02:31

    wrap with SingleChildScrollView Widget here's my code to solve this situation: it is best and easiest method

    SingleChildScrollView(
                  child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: <Widget>[
              Hero(
                tag: 'logo',
                            child: Container(
                  height: 200.0,
                  child: Image.asset('images/logo.png'),
                ),
              ),
              SizedBox(
                height: 48.0,
              ),
              TextField(
                onChanged: (value) {
                  //Do something with the user input.
                },
                decoration:  kTextFieldDecoration.copyWith(hintText: 'Enter username'),
              ),
              SizedBox(
                height: 8.0,
              ),
              TextField(
                onChanged: (value) {
                  //Do something with the user input.
                },
                decoration: kTextFieldDecoration.copyWith(hintText: 'Enter password'),
              ),
              SizedBox(
                height: 24.0,
              ),
    
               RoundedButton(
                colour: Colors.blueAccent,
                text: 'Register',
                onPressed: () {
                //later todo
                },
              ),
    
            ],
          ),
        ),
    
    0 讨论(0)
提交回复
热议问题