Flutter TextFormField 被键盘隐藏 [英] Flutter TextFormField hidden by keyboard
本文介绍了Flutter TextFormField 被键盘隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
注意:我使用 Navigator.of(context).push 来推送 ModalRoute,
我有一个带有 ModalRoute
和 TextFormField
的页面,但是当键盘出现时,输入被键盘隐藏了,如何解决这个问题?>
返回容器(孩子:列表视图(孩子们:<小部件>[//其他小部件SizedBox(高度:_qtyAnimation.value),排(孩子们:<小部件>[展开(孩子:文本("朱姆拉",样式:TextStyle(fontWeight:FontWeight.bold),),),大小盒(宽度:145.0,孩子:TextFormField(焦点节点:_qtyFocusNode,控制器:数量,键盘类型:TextInputType.number,textAlign: TextAlign.center,装饰:输入装饰(contentPadding: EdgeInsets.all(0.0),前缀图标:图标按钮(图标:图标(Icons.remove),onPressed: () {},),边框:轮廓输入边框(边框:BorderSide(颜色:Colors.grey,宽度:0.1),),后缀图标:图标按钮(图标:图标(Icons.add),onPressed: () {},),),),),],),],);
这就是我的代码,我尝试使用 focusnode 等,结果仍然相同请帮帮我
解决方案
感谢用文本字段底部的填充解决了我的问题
填充(填充:EdgeInsets.only(底部:MediaQuery.of(context).viewInsets.bottom));
和母马反向列表
NOTE: Im using Navigator.of(context).push to push ModalRoute,
Hi I have page with ModalRoute
with TextFormField
in the body, but when keyboard show up, the input is being hide by keyboard, how to fix this?
return Container(
child: ListView(
children: <Widget>[
//other widget
SizedBox(height: _qtyAnimation.value),
Row(
children: <Widget>[
Expanded(
child: Text(
"Jumlah",
style: TextStyle(fontWeight: FontWeight.bold),
),
),
SizedBox(
width: 145.0,
child: TextFormField(
focusNode: _qtyFocusNode,
controller: qty,
keyboardType: TextInputType.number,
textAlign: TextAlign.center,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(0.0),
prefixIcon: IconButton(
icon: Icon(Icons.remove),
onPressed: () {},
),
border: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.grey, width: 0.1),
),
suffixIcon: IconButton(
icon: Icon(Icons.add),
onPressed: () {},
),
),
),
),
],
),
],
);
thats my code, i try with focusnode and more, still same result please help me
解决方案
thanks solve my problem with this padding on bottom of textfield
Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom));
and mare reverse list
这篇关于Flutter TextFormField 被键盘隐藏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文