Is there any way in flutter to control the padding of error text and hint text separately in TextFormField? if not how can we make a custom and separate error text widget below TextFormField.
Try this if could be help for you
class CustomTextFormFiled extends StatefulWidget {
const CustomTextFormFiled({Key key}) : super(key: key);
@override
_CustomTextFormFiledState createState() => _CustomTextFormFiledState();
}
class _CustomTextFormFiledState extends State<CustomTextFormFiled> {
bool isError = false;
@override
Widget build(BuildContext context) {
return Column(
children: [
TextFormField(
onSaved: (value){
if(value.isEmpty){
isError=true;
}
},
),
if(isError)...{
const Padding(
padding: EdgeInsets.all(10),
child: Text("Error Details"),
)
}
],
);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.