简体   繁体   English

Flutter 出现键盘时 UI 不上移

[英]Flutter UI not moving up when keyboard appears

I don't understand why is this Scaffold not moving up when the keyboard is shown.我不明白为什么在显示键盘时这个 Scaffold 没有向上移动。

  @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尝试在Scaffold小部件内添加

Refer resizeToAvoidBottomInset请参阅resizeToAvoidBottomInset

resizeToAvoidBottomInset: true,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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