text_field_custom 0.0.3
text_field_custom: ^0.0.3 copied to clipboard
In this package I have customized the textformfield for easy use.
๐ฆ text_field_custom #
A highly customizable, reusable, and production-ready Flutter text field widget with built-in support for titles, validation, borders, icons, formatting, read-only mode, and many UI configurations.
Designed to reduce boilerplate, improve consistency, and speed up form development across Flutter projects.
โจ Features #
- โ Optional title with required indicator
- โ Built-in validation support
- โ Supports prefix & suffix widgets
- โ Supports readonly & disabled fields
- โ Supports filled & outlined styles
- โ Supports formatters, maxLength, multiline
- โ Supports keyboard actions & focus control
- โ Clean, reusable & production-ready API
๐ธ Preview #
You can add screenshots here later from the example app.
๐ Installation #
Add this to your pubspec.yaml:
dependencies:
text_field_custom: ^1.0.0
Then run:
flutter pub get
๐ฆ Import #
import 'package:text_field_custom/text_field_custom.dart';
๐งฑ Basic Usage #
TextFieldCustom(
title: "Email",
hintText: "Enter your email",
isRequired: true,
validator: (v) {
if (v == null || v.isEmpty) return "Email is required";
if (!v.contains("@")) return "Invalid email";
return null;
},
)
๐งฉ Usage Examples #
1๏ธโฃ Simple Field #
TextFieldCustom(
title: "Name",
hintText: "Enter your name",
)
2๏ธโฃ Password Field #
TextFieldCustom(
title: "Password",
hintText: "Enter password",
obscureText: true,
)
3๏ธโฃ Phone Field with Formatter #
TextFieldCustom(
title: "Phone",
keyboardType: TextInputType.phone,
maxLength: 10,
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
)
4๏ธโฃ Read-only Picker Field #
TextFieldCustom(
title: "Date of Birth",
hintText: "Select date",
readOnly: true,
onTap: () {
// Open date picker
},
)
5๏ธโฃ With Prefix & Suffix #
TextFieldCustom(
title: "Search",
hintText: "Search",
prefix: Icon(Icons.search),
suffix: Icon(Icons.mic),
)
6๏ธโฃ Multiline Text Field #
TextFieldCustom(
title: "Description",
maxLines: 4,
)
7๏ธโฃ Filled Style Field #
TextFieldCustom(
title: "Username",
filled: true,
fillColor: Colors.grey.shade100,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(12),
),
)
8๏ธโฃ Disabled / View-only Field #
TextFieldCustom(
title: "User ID",
initialValue: "USR_12345",
onlyText: true,
)
๐งช Example App #
A complete example app is available in the:
/example
folder.
Run it using:
cd example
flutter run
๐งฉ Available Parameters #
| Parameter | Description |
|---|---|
title |
Label shown above field |
hintText |
Placeholder text |
controller |
TextEditingController |
validator |
Validation function |
obscureText |
Password mode |
readOnly |
Makes field readonly |
enabled |
Enables / disables field |
onlyText |
View-only mode |
prefix |
Prefix widget |
suffix |
Suffix widget |
filled |
Filled background |
fillColor |
Background color |
border |
Custom border |
keyboardType |
Keyboard type |
textInputAction |
Keyboard action |
maxLines |
Multiline support |
maxLength |
Character limit |
inputFormatters |
Input formatters |
onChanged |
Change callback |
onSubmitted |
Submit callback |
๐๏ธ Why use this package? #
- ๐ Reduces repetitive UI code
- ๐ฏ Standardizes form UI across apps
- ๐งผ Clean and scalable architecture
- ๐ฆ Easy to maintain and extend
๐ฃ๏ธ Roadmap #
- โ Theme presets
- โ Built-in password toggle
- โ SearchField / DateField variants
- โ Form builder helpers
๐ค Contributing #
Contributions, issues, and feature requests are welcome!
๐งโ๐ป Author #
Amarjeet Srivastava Senior Flutter Developer
๐ License #
MIT License