Last updated:
0 purchases
astextfield
astextfield #
Creating UITextField Package for use globally
Getting Started #
This project is a starting point for a Dart
package,
a library module containing code that can be shared easily across
multiple Flutter or Dart projects.
For help getting started with Flutter, view our
online documentation, which offers tutorials,
samples, guidance on mobile development, and a full API reference.
Example #
//Initialize TextEditingController
var userName = TextEditingController();
//Define validator
String validateName(String value) {
if (value.length == 0) {
return enterUserName;
}
return null;
}
//Input formatter for name text field
List<TextInputFormatter> nameInputFormatter = [
WhitelistingTextInputFormatter(RegExp("[a-zA-Z0-9]")),
LengthLimitingTextInputFormatter(30)
];
//CLASS OBJECT - FULL NAME
final userNameField = ASTextField(
"User name", //Required hint name
userName, //Required TextEditingController
txtValidator: validateName, //Optional validator
keyboardType: InputType.normal, //Optional Keyboard type
currentFocus: focusUserName, //Optional current focus
nextFocus: focusEmail, //Optional next focus
txtInputFormatter: nameInputFormatter, //Optional Input formatter
keyboardAction: InputAction.done, //Optional Keyboard action next/done
txtColor: Colors.black, //Optional text color
disableTxtColor: Colors.grey, //Optional disable text color
txtFontFamily: "Roboto", //Optional text font family
txtFontSize: 20, //Optional text font size
txtErrorFontStyle: FontStyle.normal, //Optional text font style
txtErrorFontWeight: FontWeight.normal, //Optional text font weight
txtErrorColor: Colors.red, //Optional text error color
txtHintColor: Colors.grey, //Optional text hint color
isFormEnable: false); //Optional value for form field enable or not
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.