Flutter Enable/Disable Button based on TextFormField content
问题 How can I activate/deactivate a button based on the content of a TextFormField? I want to make sure a user can only press Button X if the TextFormField has 10 entered numbers (if it's a mobile number). Thanks! 回答1: A simple way would be to set the autovalidate property of our TextFormField to true . This will automatically detect for changes on our TextFormField widget. We can then try to check if our TextFormField's value has a String length of 10 characters on the validator property . After