简体   繁体   English

如何在键盘上方滚动 TextFiled?

[英]How can I Scroll TextFiled just above the keyboard?

I have list of tasks and below that I have TextField, now when the multiple tasks added then I need to show TextField just above the keyboard.我有任务列表,下面有 TextField,现在当添加多个任务时,我需要在键盘上方显示 TextField。

How can I achieve this?我怎样才能做到这一点?

Thanks in Advance!提前致谢!

Small piece of code:一小段代码:

    TextFormField(
      scrollPadding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom - 160), // this line not work for me.
      cursorColor: Colors.black,
      toolbarOptions: ToolbarOptions(copy: true, cut: true, paste: true, selectAll: true),
      showCursor: MediaQuery.of(context).viewInsets.bottom != 0 ? true : false,
      style: new TextStyle(
        fontSize: 15.0,
        fontFamily: "Roboto",
        fontWeight: FontWeight.w400,
        color: darkGreyColor,
      ),
      controller: _textFieldControllerSubTaskAdd,
      focusNode: focusNodeSubTask,
      keyboardType: TextInputType.text,
      textInputAction: TextInputAction.done,
      onChanged: (text) {
      },      
    ),

在此处输入图像描述

Scaffold(
    resizeToAvoidBottomInset: true,
    body: SingleChildScrollView(
      child: Container(
        child: Column(
          children: <Widget>[
            TextFormField(
              decoration: InputDecoration(
                labelText: 'Enter Text',
              ),
            ),TextFormField(
              decoration: InputDecoration(
                labelText: 'Enter Text',
              ),
            ),TextFormField(
              decoration: InputDecoration(
                labelText: 'Enter Text',
              ),
            ),TextFormField(
              decoration: InputDecoration(
                labelText: 'Enter Text',
              ),
            ),TextFormField(
              decoration: InputDecoration(
                labelText: 'Enter Text',
              ),
            ),TextFormField(
              decoration: InputDecoration(
                labelText: 'Enter Text',
              ),
            ),TextFormField(
              decoration: InputDecoration(
                labelText: 'Enter Text',
              ),
            ),
            TextFormField(
              decoration: InputDecoration(
                labelText: 'Enter Text',
              ),
            )
          ],
        ),
      ),
    )
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何更改 TextFiled 中 Focused prefixIcon 图标颜色的颜色? - How can I change the color of Focused prefixIcon icon color in TextFiled? 我希望键盘在删除或隐藏 Textfiled 时保留在屏幕上 Flutter? - I want the Keyboard to remain on the screen while the Textfiled is removed or hidden Flutter? 在 ListView 中的键盘上方滚动 TextFormField - Scroll TextFormField above keyboard in ListView 当 id 在 flutter 中关闭键盘时如何取消对 TextFiled 的关注 - How to unfocus TextFiled When id dismis the keyboard in flutter 当用户转到Flutter中的下一个文本文件时,如何获取文本字段的值 - How can i get value of textfield when user go to next textfiled in flutter Flutter TextEditingController 不在键盘上方滚动 - Flutter TextEditingController does not scroll above keyboard 我无法使用 textfiled 更新用户数据 - I can't update user data by using textfiled 拖动手柄时如何使 DraggableScrollableSheet 向上滚动,就像谷歌地图一样 - How can I make DraggableScrollableSheet scroll up when dragging the handle, just like google map does Flutter - 如何在键盘出现时使用 SingleScrollView() 滚动整个屏幕,而不仅仅是自动显示文本 - Flutter - how to use SingleScrollView() to Scroll Entire Screen when Keyboard Appears not just text automatically 如何在 AppWebView 上方创建按钮? - How can i create button above inAppWebView?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM