dart - Flutter TextFormField 被键盘隐藏

标签 dart flutter flutter-layout

注意:我使用 Navigator.of(context).push 来推送 ModalRoute,

您好,我的页面有 ModalRouteTextFormField 在正文中,但是当键盘显示时,输入被键盘隐藏,如何解决这个问题?

enter image description here

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 等等,结果仍然相同 请帮帮我

最佳答案

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

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

和母马反向列表

关于dart - Flutter TextFormField 被键盘隐藏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53586892/

相关文章:

android - 无法在 flutter 中运行 stripe_sdk 示例

asynchronous - 根据另一个 Future 的结果创建 Future

flutter - 在 Flutter 中,如何通过 checklisttile 使单个选项卡击键成为选项卡?

dart - 在定制聚合物元件中,哪里需要 super.attached?

android - 在Android Studio创建的Flutter项目中添加Realm数据库

flutter - 调度第一个 bloc 事件或 cubit 方法,在 StatelessWidget 内的页面开始

Flutter评级栏包选择和未选择的容器

flutter - 在 flutter 应用程序中支持自定义文件扩展名(在 flutter 中打开扩展名为 .abc 的文件)

dart - 如何更改 ListTile 的背景颜色?

android - Flutter - setState 不更新内部有状态小部件