custom_textfield_with_countrycode 0.0.4
custom_textfield_with_countrycode: ^0.0.4 copied to clipboard
Custom TextFormField with country code picker, password visibility toggle, and extensive customization options.
Custom TextField With Country Code #
A Flutter package that provides a highly customizable TextField widget with integrated country code picker and password visibility toggle functionality.
Features #
- π± Built-in country code picker with flag display
- π Password field with visibility toggle
- π¨ Highly customizable appearance
- β¨ Support for form validation
- π Input formatting options
- π Customizable favorite country codes
- π― Callback support for text and country code changes
Getting started #
Add this to your package's pubspec.yaml
file:
dependencies:
custom_textfield_with_countrycode: ^1.0.0
Usage #
Basic Phone Number Field #
CustomTextFieldWithCountryCode(
controller: TextEditingController(),
hintText: 'Enter phone number',
countrycode: true,
keyboardType: TextInputType.phone,
onCountryCodeChanged: (code) {
print('Selected country code: $code');
},
)
Password Field #
CustomTextFieldWithCountryCode(
controller: TextEditingController(),
hintText: 'Enter password',
isPassword: true,
passwordIconColor: Colors.blue,
validator: (value) {
if (value?.isEmpty ?? true) {
return 'Password is required';
}
return null;
},
)
Regular Text Field #
CustomTextFieldWithCountryCode(
controller: TextEditingController(),
hintText: 'Enter email',
labelText: 'Email',
keyboardType: TextInputType.emailAddress,
onChanged: (value) {
print('Email: $value');
},
)
Properties #
Property | Type | Description |
---|---|---|
controller | TextEditingController | Controls the text being edited |
hintText | String | Placeholder text |
labelText | String | Label text above the field |
isPassword | bool | Enable password mode with visibility toggle |
countrycode | bool | Show country code picker |
onCountryCodeChanged | Function(String)? | Callback when country code changes |
validator | FormFieldValidator | Form validation function |
keyboardType | TextInputType | Type of keyboard to display |
Additional information #
For issues and feature requests, please visit the GitHub repository.
License #
This project is licensed under the MIT License - see the LICENSE file for details.