扩展maxLines属性时自动滚动多行TextFormField [英] Automatically scroll multiline TextFormField when it extends the maxLines attribute
问题描述
我正在实现将maxLines属性设置为3的TextFormField.一旦用户从第四行开始,如何使TextFormField向下滚动?此刻,光标不再可见,直到用户用手向下滚动.有没有办法自动执行此操作?
I'm implementing a TextFormField with the maxLines attribute set to 3. How can I make the TextFormField scroll down once the user starts with his fourth line? At the moment the cursor is just not visible anymore until the user scrolls down by hand. Is there a way to do this automatically?
在文本字段"示例中的flutter_gallery应用程序中实际上体现了此行为.只需在实时故事"输入中键入一个长文本,直到到达第四行.
我的代码的重要部分实际上看起来像这样:
This behaviour is actually featured in the flutter_gallery app in the 'Text fields' example. Just type a long text to the 'Live story' input until it reaches the fourth line.
The important parts of my code actually look like this:
import 'package:flutter/material.dart';
class TextFormFieldDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Form(
child: new TextFormField(
maxLines: 3,
),
),
);
}
}
到目前为止,我还没有找到解决此问题的方法.
此问题会影响iOS和android.
So far I have found no workaround for this issue.
This issue affects both iOS and android.
推荐答案
在Flutter Framework中,这似乎是缺少的功能,我已经提交了一个错误来解决该问题: https://github.com/flutter/flutter/issues/9365
This appears to be a missing feature in the Flutter Framework, I've filed a bug to get it resolved: https://github.com/flutter/flutter/issues/9365
这篇关于扩展maxLines属性时自动滚动多行TextFormField的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!