简体   繁体   English

处理颤振中表单字段的更改

[英]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.

相关问题 观察表单上的字段并报告更改 - Observe fields on a form and report changes 如何处理 React 表单字段中的空值? - How to handle empty value in React form fields? AlphineJS:如何处理许多不同的表单字段? - AlphineJS: How handle many different form fields? javascript如何将多个表单字段的更改绑定到同一函数中? - javascript how to bind changes of multiple form fields into the same function? 验证单个表单的特定字段以进行各种选择框更改-jQuery - Validate specific fields of a single form for various select box changes - jQuery 如何处理反应式 Angular 表单中的两个选择字段? - How to handle two selects fields in a reactive Angular form? 如何使用 ReactJS 中的单个函数处理表单字段中的错误? - How to handle errors in my form fields with a single function in ReactJS? Redux Form-如何处理异步选择字段上的默认选择? - Redux Form - How to handle default selections on async select fields? 角度验证-启用/禁用输入字段可更改表单的有效性 - Angular validations - Enabling/Disabling input fields changes validity of form 值更改时表单文本字段的代码事件侦听器? - Code Event Listener for form text fields when value changes?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM