如何更改文本字段颤动内部的值? [英] How do you change the value inside of a textfield flutter?
本文介绍了如何更改文本字段颤动内部的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 TextEditingController
,如果用户单击一个按钮,它将在其中填充信息。我似乎无法弄清楚如何更改 Textfield
或 TextFormField
内的文本。有解决方案吗?
I have a TextEditingController
where if a user clicks a button it fills in with information. I can't seem to figure out how to change the text inside of a Textfield
or TextFormField
. Is there a solution?
推荐答案
只需更改 text
属性
TextField(
controller: txt,
),
RaisedButton(onPressed: () {
txt.text = "My Stringt";
}),
而 txt
只是一个 TextEditingController
var txt = TextEditingController();
这篇关于如何更改文本字段颤动内部的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文