custom_textfield_with_countrycode 0.0.4

SDKflutter
Platformandroidioswindowslinuxmacosweb

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

PropertyTypeDescription
controllerTextEditingControllerControls the text being edited
hintTextStringPlaceholder text
labelTextStringLabel text above the field
isPasswordboolEnable password mode with visibility toggle
countrycodeboolShow country code picker
onCountryCodeChangedFunction(String)?Callback when country code changes
validatorFormFieldValidator?Form validation function
keyboardTypeTextInputTypeType 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.