Skip to content Skip to sidebar Skip to footer

Textfield Gets Hidden When The Keyboard Pops In

import 'package:e_expense/home.dart'; import 'package:flutter/material.dart'; class SignUpPage extends StatefulWidget { @override _SignUpState createState() => _SignUpState(

Solution 1:

A few changes:

  • Set resizeToAvoidBottomPadding true

  • Remove the Flexible Widget

  • Wrap your first Column inside SingleChildScrollView

    @override
      Widget build(BuildContext context) {
        returnScaffold(
            resizeToAvoidBottomPadding: true,
            appBar: AppBar(
              iconTheme: IconThemeData(
                color: Colors.green,
              ),
              centerTitle: true,
              title: Text(
                "Welcome to E-Expense",
                style: TextStyle(
                    fontWeight: FontWeight.bold,
                    fontFamily: 'Montserrat',
                    color: Colors.green),
              ),
              elevation: 0.0,
              backgroundColor: Color(0x00000000).withOpacity(0),
            ),
            body: SingleChildScrollView(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  Container(
                    child: Stack(
                      children: <Widget>[
                        Container(
                          padding: EdgeInsets.fromLTRB(15.0, 50.0, 0.0, 0.0),
                          child: Text(
                            "Signup",
                            style: TextStyle(
                              fontSize: 80.0,
                              fontWeight: FontWeight.bold,
                            ),
                          ),
                        ),
                        Container(
                          padding: EdgeInsets.fromLTRB(270.0, 50.0, 0.0, 0.0),
                          child: Text(
                            ".",
                            style: TextStyle(
                              color: Colors.green,
                              fontSize: 80.0,
                              fontWeight: FontWeight.bold,
                            ),
                          ),
                        )
                      ],
                    ),
                  ),
                  Container(
                    padding: EdgeInsets.only(top: 35.0, left: 20.0, right: 20.0),
                    child: SingleChildScrollView(
                      child: Column(
                        children: <Widget>[
                          TextField(
                            decoration: InputDecoration(
                              labelText: 'USER NAME',
                              labelStyle: TextStyle(
                                fontFamily: 'Montserrat',
                                fontWeight: FontWeight.bold,
                                color: Colors.grey,
                              ),
                              focusedBorder: UnderlineInputBorder(
                                borderSide: BorderSide(
                                  color: Colors.green,
                                ),
                              ),
                            ),
                          ),
                          SizedBox(height: 10.0),
                          TextField(
                            decoration: InputDecoration(
                              labelText: 'EMAIL',
                              labelStyle: TextStyle(
                                fontFamily: 'Montserrat',
                                fontWeight: FontWeight.bold,
                                color: Colors.grey,
                              ),
                              focusedBorder: UnderlineInputBorder(
                                borderSide: BorderSide(
                                  color: Colors.green,
                                ),
                              ),
                            ),
                          ),
                          SizedBox(height: 10.0),
                          TextField(
                            decoration: InputDecoration(
                              labelText: 'PASSWORD',
                              labelStyle: TextStyle(
                                fontFamily: 'Montserrat',
                                fontWeight: FontWeight.bold,
                                color: Colors.grey,
                              ),
                              focusedBorder: UnderlineInputBorder(
                                borderSide: BorderSide(
                                  color: Colors.green,
                                ),
                              ),
                            ),
                          ),
                          SizedBox(height: 10.0),
                          TextField(
                            decoration: InputDecoration(
                              labelText: 'REPEAT PASSWORD',
                              labelStyle: TextStyle(
                                fontFamily: 'Montserrat',
                                fontWeight: FontWeight.bold,
                                color: Colors.grey,
                              ),
                              focusedBorder: UnderlineInputBorder(
                                borderSide: BorderSide(
                                  color: Colors.green,
                                ),
                              ),
                            ),
                          ),
                          SizedBox(height: 40.0),
                          ButtonBar(
                            alignment: MainAxisAlignment.end,
                            children: <Widget>[
                              FlatButton(
                                  onPressed: () {},
                                  child: Text(
                                    'CANCEL',
                                    style: TextStyle(
                                      fontFamily: 'Montserrat',
                                      fontWeight: FontWeight.normal,
                                      color: Colors.black,
                                    ),
                                  )),
                              RaisedButton(
                                onPressed: () {
                                  Navigator.of(context).push(MaterialPageRoute(
                                      builder: (BuildContext context) => null,
                                      fullscreenDialog: false));
                                },
                                color: Colors.green,
                                child: Text(
                                  'SIGNUP',
                                  style: TextStyle(
                                      fontFamily: 'Montserrat', fontSize: 15.0),
                                ),
                                textColor: Colors.white,
                              )
                            ],
                          )
                        ],
                      ),
                    ),
                  ),
                ],
              ),
            ));
      }
    

Solution 2:

Try wrapping the widget that contains those TextFields with a SingleChildScrollView.

Solution 3:

Please use

android:windowSoftInputMode="adjustPan" in forAndroidManifest.xml for activity SignUpPage

Post a Comment for "Textfield Gets Hidden When The Keyboard Pops In"