简体   繁体   English

键盘上方的颤振/飞镖滚动文本字段

[英]Flutter/Dart Scrolling textfield above keyboard

I am using textfields, how can I make it so it scrolls up a bit when entering email and password?我正在使用文本字段,我怎样才能使它在输入电子邮件和密码时向上滚动一点?

Here is a preview of the code这是代码的预览

https://pastebin.com/4EngQDV5 https://pastebin.com/4EngQDV5

blank

I am using textfields, how can I make it so it scrolls up a bit when entering email and password?我正在使用文本字段,如何使它在输入电子邮件和密码时向上滚动一点?

Here is a preview of the code这是代码的预览

https://pastebin.com/4EngQDV5 https://pastebin.com/4EngQDV5

blank

I am using textfields, how can I make it so it scrolls up a bit when entering email and password?我正在使用文本字段,如何使它在输入电子邮件和密码时向上滚动一点?

Here is a preview of the code这是代码的预览

https://pastebin.com/4EngQDV5 https://pastebin.com/4EngQDV5

blank

I am using textfields, how can I make it so it scrolls up a bit when entering email and password?我正在使用文本字段,如何使它在输入电子邮件和密码时向上滚动一点?

Here is a preview of the code这是代码的预览

https://pastebin.com/4EngQDV5 https://pastebin.com/4EngQDV5

blank

I am using textfields, how can I make it so it scrolls up a bit when entering email and password?我正在使用文本字段,如何使它在输入电子邮件和密码时向上滚动一点?

Here is a preview of the code这是代码的预览

https://pastebin.com/4EngQDV5 https://pastebin.com/4EngQDV5

blank

I am using textfields, how can I make it so it scrolls up a bit when entering email and password?我正在使用文本字段,如何使它在输入电子邮件和密码时向上滚动一点?

Here is a preview of the code这是代码的预览

https://pastebin.com/4EngQDV5 https://pastebin.com/4EngQDV5

blank

I found a nice solution I have affed to the TextFormField the scrollPadding property as follows我找到了一个很好的解决方案,我已将 scrollPadding 属性添加到 TextFormField,如下所示

child: TextFormField(
        scrollPadding: EdgeInsets.only(
            bottom: MediaQuery.of(context).viewInsets.bottom + fontSize*4),
        validator: _validator,
        cursorColor: cTextRegularColor,
        controller: _controller,
        obscureText: _obscure,
        obscuringCharacter: '*',
        textAlign: _textAlign,
        keyboardType: _input,
        style: const TextStyle(
          color: cTextRegularColor,
          fontSize: fontSize,
        ),

By Settings the bottomInset, in my forms, whenever the user taps on a TextField in the form, its not only scrolling down, it also shows the next TextField in the form, so the user does not need to scroll after he finished filling the current field.通过设置bottomInset,在我的表单中,每当用户点击表单中的TextField时,它不仅会向下滚动,还会显示表单中的下一个TextField,因此用户在填写完当前内容后不需要滚动场地。

obviously , when the user will tap the next field in the form , the screen will scroll again , and again, show the next field,显然,当用户点击表单中的下一个字段时,屏幕将再次滚动,并再次显示下一个字段,

I figured out that in long forms (more than 5 fields), the user does not need to scroll at all.我发现在长表单(超过 5 个字段)中,用户根本不需要滚动。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM