android – Flutter键盘使文本字段隐藏

前端之家收集整理的这篇文章主要介绍了android – Flutter键盘使文本字段隐藏前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我是新来的人.我添加了一个带有文本字段的表单,当我单击文本字段和键盘时,文本字段会上升.

这是我的代码

Widget build(BuildContext context) {

MediaQueryData mediaQuery = MediaQuery.of(context);
return new Scaffold(
  body:  new Container(
      color: Colors.purple,constraints: new BoxConstraints.expand(),padding: EdgeInsets.only(top: 10.0,left: 10.0,right: 10.0,bottom: mediaQuery.viewInsets.bottom,),child: SingleChildScrollView(
        child: Container(
            child: Column(
                crossAxisAlignment: CrossAxisAlignment.center,mainAxisAlignment: MainAxisAlignment.center,children: <Widget>[
                  SizedBox(height: 12.0),Text(
                    'What is your Bussiness Name?',style: TextStyle(fontSize: 24.0),AppForm(),],padding: EdgeInsets.only(left: 10.0,bottom: mediaQuery.viewInsets.bottom),decoration: BoxDecoration(
              borderRadius: BorderRadius.all(Radius.circular(30.0)),color: Colors.white,)
          )
      ),);
  }

这是没有打开键盘的结果:
Image without keyboard

这是打开键盘后的图像:
Image after opening the keyboard

这是我的扑动医生输出.

Doctor summary (to see all details,run flutter doctor -v): [√] Flutter 
(Channel beta,v0.5.1,on Microsoft Windows [Version 10.0.17134.165],locale 
en-US) [√] Android toolchain - develop for Android devices (Android SDK 
28.0.0) [√] Android Studio (version 3.1) [!] VS Code,64-bit edition (version 
1.25.1) [!] Connected devices ! No devices available ! Doctor found issues in 
2 categories.

任何想法如何解决这个问题?

解决方法

这就是我的情况.你肯定是将脚手架包裹在另一个脚手架内.你的颤动应用程序中应该只有一个脚手架小部件,即主要布局.简单地移除您拥有的所有祖先脚手架并且仅保留一个脚手架.不要将脚手架包裹在另一个脚手架中.尽管如此,你可以将脚手架包裹在容器内.

请确保在main.dart文件中没有这样做: –

✖✖

return Scaffold(
body : YourNewFileName(),);

尽管上面的代码执行此操作: –
✔✔

return YourNewFileName();

猜你在找的Flutter相关文章