๐Ÿ“ฆ 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

Libraries

text_field_custom