【发布时间】:2019-05-04 08:12:37
【问题描述】:
注意:我使用 Navigator.of(context).push 来推送 ModalRoute,
您好,我在正文中有 ModalRoute 和 TextFormField 的页面,但是当键盘显示时,输入被键盘隐藏,如何解决这个问题?
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: () {},
),
),
),
),
],
),
],
);
这就是我的代码,我尝试使用 focusnode 等等,结果仍然相同 请帮帮我
【问题讨论】:
-
您可以使用 FocusNode 来做到这一点:stackoverflow.com/questions/50736571/…
-
它对我不起作用,已经测试了那个链接,
-
我的解决方案here at this thread 解决了这个问题。它非常简短,不需要动画。
标签: dart flutter flutter-layout