textFrom method
Implementation
Widget textFrom(String labelProp) {
bool isPassword = labelProp == "password.hint";
return TextFormField(
obscureText: isPassword,
decoration: decoration(labelProp),
onSaved: (text) {
setState(() {
if (isPassword) {
_password = text!;
} else {
_token = text!;
}
});
},
validator: (text) {
if (text!.isEmpty) {
return tr("required");
}
if (hasApiError) {
return tr("validation.error.token.or.password");
}
return null;
},
);
}