简体   繁体   中英

Flutter UI not moving up when keyboard appears

I don't understand why is this Scaffold not moving up when the keyboard is shown.

  @override
  Widget build(BuildContext context) {
    if (widget.usuario.city.length < 3) {
      controladorUbicacion.text = ciudadPropuesta + ", " + provinciaPropuesta;
    }
    if (widget.usuario.country.length < 3) {
      controladorPais.text = paisPropuesto;
    }
    return SafeArea(
      top: false,
      bottom: true,
      child: Scaffold(
        appBar: AppBar(
          backgroundColor: AppColors.rojoMovMap,
          title: Text("miperfil".tr()),
        ),
        body: SingleChildScrollView(
          child: Column(
            children: [
              //username
              Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: TextFormField(
                    onChanged: (text) {},
                    controller: controladorUsername,
                    decoration: InputDecoration(
                      hintText: 'tuusername'.tr().toString(),
                      hintStyle: TextStyle(color: Colors.black, fontSize: 14),
                      labelText: 'tuusername'.tr().toString(),
                      labelStyle:
                          TextStyle(fontSize: 18, color: AppColors.negroMovMap),
                    ),
                  )),

              //ubicacion
              Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: TextFormField(
                    onChanged: (text) {},
                    controller: controladorUbicacion,
                    decoration: InputDecoration(
                      hintText: 'tuubicacion'.tr().toString(),
                      hintStyle: TextStyle(color: Colors.black, fontSize: 14),
                      labelText: 'tuubicacion'.tr().toString(),
                      labelStyle:
                          TextStyle(fontSize: 18, color: AppColors.negroMovMap),
                    ),
                  )),

              //pais
              Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: TextFormField(
                    onChanged: (text) {},
                    controller: controladorPais,
                    decoration: InputDecoration(
                      hintText: 'tupais'.tr().toString(),
                      hintStyle: TextStyle(color: Colors.black, fontSize: 14),
                      labelText: 'tupais'.tr().toString(),
                      labelStyle:
                          TextStyle(fontSize: 18, color: AppColors.negroMovMap),
                    ),
                  )),
              Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: TextFormField(
                    onChanged: (text) {},
                    controller: controladorNombre,
                    decoration: InputDecoration(
                      hintText: 'tunombre'.tr().toString(),
                      hintStyle: TextStyle(color: Colors.black, fontSize: 14),
                      labelText: 'tunombre'.tr().toString(),
                      labelStyle:
                          TextStyle(fontSize: 18, color: AppColors.negroMovMap),
                    ),
                  )),
              Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: TextFormField(
                    onChanged: (text) {},
                    controller: controladorApellidos,
                    decoration: InputDecoration(
                      hintText: 'tusapellidos'.tr().toString(),
                      hintStyle: TextStyle(color: Colors.black, fontSize: 14),
                      labelText: 'tusapellidos'.tr().toString(),
                      labelStyle:
                          TextStyle(fontSize: 18, color: AppColors.negroMovMap),
                    ),
                  )),
              Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: TextFormField(
                    onChanged: (text) {},
                    controller: controladorWeb,
                    decoration: InputDecoration(
                      hintText: 'tuweb'.tr().toString(),
                      hintStyle: TextStyle(color: Colors.black, fontSize: 14),
                      labelText: 'tuweb'.tr().toString(),
                      labelStyle:
                          TextStyle(fontSize: 18, color: AppColors.negroMovMap),
                    ),
                  )),
              Padding(
                  padding: const EdgeInsets.all(8.0),
                  child: TextFormField(
                    onChanged: (text) {},
                    decoration: InputDecoration(
                      hintText: 'PersonalInfoWeight'.tr().toString(),
                      hintStyle: TextStyle(color: Colors.black, fontSize: 14),
                      labelText: 'PersonalInfoWeight'.tr().toString(),
                      labelStyle:
                          TextStyle(fontSize: 18, color: AppColors.negroMovMap),
                    ),
                  )),
            ],
          ),
        ),
      ),
    );
  }
}

在此处输入图像描述

在此处输入图像描述

Try to add inside Scaffold widget

Refer resizeToAvoidBottomInset

resizeToAvoidBottomInset: true,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM