A customizable and flexible Flutter package that helps you build text input fields, including password fields and PIN code inputs, using reusable models and styling components.
FieldModelto configure various properties of text fieldsPasswordFieldwidget with toggleable visibility and input validationPinCodeFieldwidget for entering secure codes (e.g., OTPs)AppPhoneFieldfor formatted phone number input with country pickerAppSearchFieldfor toggleable in-app search with clear buttonInputFocusHandlerto easily manage input focus between fieldsMobileNumberInfofor working with international phone numbers- Configurable
InputDecorationStylefor border, padding, radius, etc.
Add the following to your pubspec.yaml:
dependencies:
text_field_builder: latest_versionThen run:
flutter pub getfinal fieldModel = FieldModel(
labelText: 'Username',
hintText: 'Enter your username',
errorMsg: 'Username is required',
);PasswordField(
controller: _passwordController,
labelText: 'Password',
hintText: 'Enter your password',
validator: (value) => value!.isEmpty ? 'Required' : null,
);PinCodeField(
onChanged: (value) {
print('PIN: $value');
},
);AppPhoneField(
onChanged: (info) => print(info.completeNumber),
);AppSearchField(
fieldModel: FieldModel(
hintText: 'Search',
controller: _searchController,
onChanged: (value) => print('Searching: $value'),
),
);Change focus between fields easily:
InputFocusHandler.changeFocusField(context, currentFocus, nextFocus);Helper for formatting international numbers:
final info = MobileNumberInfo(
countryCode: '+1',
countryISOCode: 'US',
number: '1234567890',
);
print(info.completeNumber); // +11234567890You can customize input decorations, keyboard types, padding, border styles, colors, icons, and much more through FieldModel and widget parameters. The InputDecorationStyle class allows you to:
- Set custom
borderRadius,borderColor, andborderWidth - Define padding and filled background
- Use prefix/suffix icons with callbacks
- Style error messages and hints
MIT License. See LICENSE file for details.
Made with ❤️ by Shohidul Islam https://github.com/GenieCoderSrc/text_field_builder