custom_input_text 0.1.3 custom_input_text: ^0.1.3 copied to clipboard
This is a package to facilitate the text fields of email, password or a simple name
Custom Input Text #
This package facilitates the validation of emails, password with button to view the content, blocking of special characters when the text field is destined for a name or a telephone number, etc.
Example #
in this example we can validate the email with a bool emailValidation
inside a StatefulWidget
final emailCtrl = TextEditingController();
bool emailValidation;
CustomInputTextState(
placeholder: 'Correo Electrónico',
keyboardType: TextInputType.emailAddress, // if keyboarType is emailAddress, validation will be applied else default is Text
icon: Icons.alternate_email_outlined, //is optional
textController: emailCtrl,
validation: emailValidation, //in this case is optional
onChanged: (value) {
setState(() {
emailValidation = validateEmail(value);
});
},
);
In this example we can make the password visible just by typing isPassword: true
and sending validations through onChange
final passwordCtrl = TextEditingController();
bool passwordValidation;
CustomInputTextState(
placeholder: 'contraseña',
icon: Icons.lock_outline_rounded,
textController: passwordCtrl,
isPassword: true,
validation: passwordValidation, // if is true, the border of input will be color green else red
onChanged: (value) {
if (passwordCtrl.text.length >= 8 &&
passwordCtrl.text == passCtrl.text) {
setState(() {
passwordValidation = true;
});
} else {
setState(() {
passwordValidation = false;
});
}
},
);
Available customizations #
placeholder
= is requiredtextController
= is requiredicon
= is the prefixIcon but is optionalkeyboardType
= default is aTextInputType.text
isPassword
= default is falseisAName
= default is false, but when is true only allow characters from a-zisAPhone
= default is false, but when is true only allow numbers 0-9onChanged
= this is a function that can be used to validate or get the value of the text fieldvalidation
= this is a property to visually show if what the user wrote is ok or notenabled
= default is true, when it is false it does not allow writingbackgroundColor
= defalut is Colors.whiteonfocusColor
= defalutl is Colors.blueshadow
= default is trueborderRadius
= default hava a radius of 30.0 but it can change to other value