[英]handle changes of form fields in flutter
How to disable submit button unless forms form fields are edited/changed in flutter dart?除非在flutter dart中编辑/更改表单表单字段,否则如何禁用提交按钮? I'm able to disable the submit button when form fields are empty but i want to disable it when they are edited
当表单字段为空时,我可以禁用提交按钮,但我想在编辑它们时禁用它
For this king operation use Stream or any state management solutions.对于这个王者操作,使用 Stream 或任何状态管理解决方案。 this is just a basic example.
这只是一个基本的例子。 I hope this may help you.
我希望这可以帮助你。
var textValue = "";
TextFormField(
onChanged :(v){
textValue = v;
setState((){});
})
RaisedButton(
onPressed: textValue.isEmpty
? null
: () {
// do something
},
child: Text("Button"),
)
Button will be disabled onPressed has null or not implemented!按钮将被禁用onPressed为 null 或未实现!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.