Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Dart 键盘隐藏的颤振TextFormField_Dart_Flutter_Flutter Layout - Fatal编程技术网

Dart 键盘隐藏的颤振TextFormField

Dart 键盘隐藏的颤振TextFormField,dart,flutter,flutter-layout,Dart,Flutter,Flutter Layout,注意:我正在使用Navigator.of(context)。推送到推送ModalRoute, 您好,我的页面正文中有ModalRoute和TextFormField,但当键盘显示时,输入被键盘隐藏,如何修复 返回容器( 子:ListView( 儿童:[ //其他小部件 大小框(高度:_qtyAnimation.value), 划船( 儿童:[ 扩大( 子:文本( “朱姆拉”, 样式:TextStyle(fontWeight:fontWeight.bold), ), ), 大小盒子( 宽度:14

注意:我正在使用Navigator.of(context)。推送到推送ModalRoute,

您好,我的页面正文中有
ModalRoute
TextFormField
,但当键盘显示时,输入被键盘隐藏,如何修复

返回容器(
子:ListView(
儿童:[
//其他小部件
大小框(高度:_qtyAnimation.value),
划船(
儿童:[
扩大(
子:文本(
“朱姆拉”,
样式:TextStyle(fontWeight:fontWeight.bold),
),
),
大小盒子(
宽度:145.0,
子项:TextFormField(
焦点节点:_qtyFocusNode,
控制器:数量,
键盘类型:TextInputType.number,
textAlign:textAlign.center,
装饰:输入装饰(
contentPadding:EdgeInsets.all(0.0),
前缀:图标按钮(
图标:图标(图标。删除),
按下:(){},
),
边框:大纲输入边框(
边界:
边界边(颜色:颜色。灰色,宽度:0.1),
),
后缀:图标按钮(
图标:图标(Icons.add),
按下:(){},
),
),
),
),
],
),
],
);
这是我的代码,我尝试使用focusnode和更多,结果仍然相同
请帮助我(截至2018年12月3日),有几种方法:

您可以阅读以下内容以获得更好的解决方案:

内部
Scaffold()
add:


您还可以将
文本小部件
包装为。这将允许您在显示键盘时滚动。

谢谢,用文本字段底部的填充解决了我的问题

    Padding(
             padding: EdgeInsets.only(
             bottom: MediaQuery.of(context).viewInsets.bottom));
而马的反面列表

这对我来说很有用

首先加上这个

final bottom = MediaQuery.of(context).viewInsets.bottom;
然后使用SingleChildScrollView()将主窗口小部件(无论您使用什么,例如Column、ListView等)包装为如下所示

你需要“反向:正确”

脚手架也需要这两行代码

return Scaffold(
resizeToAvoidBottomInset: false,
resizeToAvoidBottomPadding: false,
body: SingleChildScrollView(...
最后,参考边集合的“底部”

body: SingleChildScrollView(
reverse: true,
child: Padding(
padding: EdgeInsets.only(bottom: bottom),
child: Container(...

Scaffold
小部件中,将
resizetoavidbottominset设置为
false

请注意,
resizetoavidbottompadding
将被弃用

Scaffold( resizeToAvoidBottomInset: false, ...)

对我来说,有效的方法是将文档与这里的提示结合起来。它使用了,LayoutBuilder,SingleChildScrollView,Padding(使用底部hack),最后是ConstrainedBox(使用扩展)。通过将这些结合起来,它可以与列中的扩展小部件一起工作

文档(LayoutBuilder的来源):

结构

 return Scaffold(
      resizeToAvoidBottomInset: false,
      resizeToAvoidBottomPadding: false,`

我也遇到过类似的问题。我尝试了所有的解决方案,但都不起作用。 最后我搬走了

<item name="android:windowFullscreen">true</item>
true

从android文件夹中的my styles.xml文件中,修复该问题。

我在modal_bottom_sheet插件中使用表单元素。我只需将以下代码添加到SingleChildScrollView即可解决此问题

padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom)

您需要将所有内容包装在SingleChildScrollView中,并将反转设置为true

SingleChildScrollView(
   reverse: true,
   child: Container(),
);

这对我来说很有用!

在我的情况下,重要的是只使用小的填充,否则打开键盘会造成很大的混乱

Padding(padding: EdgeInsets.only(bottom: 20)
检查我的解决方案:

child: Scaffold(
resizeToAvoidBottomInset: false,
resizeToAvoidBottomPadding: false,
    body: Container(
      color: Colors.black,
       child: SingleChildScrollView(
         reverse: true,
          child: Padding(
           padding: EdgeInsets.only(bottom: 20),
            child: Container(
              child: ReservationCard(
                ),
                  ),
                   ),
                    ),
                     )

也可以在这里添加普遍接受的答案,即

body: SingleChildScrollView(
          reverse: true,
          child: Container(
              child: Padding(
            padding: EdgeInsets.only(bottom: bottom),
            child: Stack(
              fit: StackFit.loose,
              children: <Widget>[

您可以使用FocusNode来实现这一点:它的可能副本对我不起作用,已经测试了该链接,对我不起作用,我的文本字段位于行内,并且sizebox
padding:EdgeInsets。仅(底部:底部)
抛出错误:底部必须是一个常量…如何解决此问题?Fabio您添加了
final bottom=MediaQuery.of(上下文).viewInsets.bottom;
小部件\u主体之后(WriteReviewModel模型){
这是我在列底部使用ConstrainedBox和SingleChildScrollView构建扩展的多行文本字段时唯一有效的方法。我花了太长时间才了解
resizeToAvoidBottomInset
。每次我使用flex布局时,我的键盘都会断开。这太糟糕了。嗯,这个案例正好解决了对于我来说,beta channel上的框在调试版本中工作,但在发布版本中键盘刚刚出现并立即隐藏,请确认是否有人遇到这种情况?没问题,它在调试和发布版本中都可以正常工作。您必须有另一个导致这种情况的附加配置。请在clean project中尝试。这是最简单的方法默认情况下,如果您的内容没有滚动(没有显示键盘),则单击鼠标。事实上,如果您的内容大于屏幕高度,即使没有键盘,也将始终滚动到底部。这可能不是您想要的。这并没有改变meGreat解决方案的问题!:)确实是一个很棒的解决方案!Thx。
Padding(padding: EdgeInsets.only(bottom: 20)
child: Scaffold(
resizeToAvoidBottomInset: false,
resizeToAvoidBottomPadding: false,
    body: Container(
      color: Colors.black,
       child: SingleChildScrollView(
         reverse: true,
          child: Padding(
           padding: EdgeInsets.only(bottom: 20),
            child: Container(
              child: ReservationCard(
                ),
                  ),
                   ),
                    ),
                     )
body: SingleChildScrollView(
          reverse: true,
          child: Container(
              child: Padding(
            padding: EdgeInsets.only(bottom: bottom),
            child: Stack(
              fit: StackFit.loose,
              children: <Widget>[
    var bottom = MediaQuery.of(context).viewInsets.bottom;
bottom = max(min(bottom, 80), 0);