textfield

Flutter Enable/Disable Button based on TextFormField content

这一生的挚爱 提交于 2020-12-03 11:24:09
问题 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

Flutter - How to change TextField hint color?

强颜欢笑 提交于 2020-11-30 04:12:24
问题 I'm a bit confused how to change the hint color of the textfield. Someone can guide me how to do it.Thanks child: TextField( style: TextStyle(fontSize: 20), decoration: InputDecoration( hintText: "Password", border: new OutlineInputBorder( borderSide: new BorderSide( color: Colors.teal, ), ), prefixIcon: const Icon( Icons.security, color: Colors.white, ), ), ), 回答1: You can do with hintStyle : in InputDecoration TextField( style: TextStyle(fontSize: 20), decoration: InputDecoration( hintText:

Flutter - How to change TextField hint color?

那年仲夏 提交于 2020-11-30 04:12:10
问题 I'm a bit confused how to change the hint color of the textfield. Someone can guide me how to do it.Thanks child: TextField( style: TextStyle(fontSize: 20), decoration: InputDecoration( hintText: "Password", border: new OutlineInputBorder( borderSide: new BorderSide( color: Colors.teal, ), ), prefixIcon: const Icon( Icons.security, color: Colors.white, ), ), ), 回答1: You can do with hintStyle : in InputDecoration TextField( style: TextStyle(fontSize: 20), decoration: InputDecoration( hintText:

Flutter - How to change TextField hint color?

倾然丶 夕夏残阳落幕 提交于 2020-11-30 04:12:03
问题 I'm a bit confused how to change the hint color of the textfield. Someone can guide me how to do it.Thanks child: TextField( style: TextStyle(fontSize: 20), decoration: InputDecoration( hintText: "Password", border: new OutlineInputBorder( borderSide: new BorderSide( color: Colors.teal, ), ), prefixIcon: const Icon( Icons.security, color: Colors.white, ), ), ), 回答1: You can do with hintStyle : in InputDecoration TextField( style: TextStyle(fontSize: 20), decoration: InputDecoration( hintText: