custom_text_field_pro 0.1.0 
custom_text_field_pro: ^0.1.0 copied to clipboard
A reusable CustomTextField widget with label, prefix/suffix icons, validation, and password toggle.
π Custom Text Field Pro #
A Flutter package that provides highly customizable text fields with built-in support for password visibility, prefix/suffix icons, and even a country code picker β all with global theming control.
π¦ Installation #
π Depend on it #
Run this command:
With Flutter:
flutter pub add custom_text_field_pro
Or add it manually to your pubspec.yaml:
dependencies:
  custom_text_field_pro: ^0.1.0
Then run:
flutter pub get
π¨ Why Custom Text Field Pro? #
This widget eliminates repetitive TextFormField styling code and gives you a beautiful, flexible input component with features like:
β Password toggle visibility β Custom icons and colors β Built-in country code picker β Global theming β Focused and unfocused border control β Reusable across your entire app
βοΈ Setup Example #
import 'package:flutter/material.dart';
import 'package:custom_text_field_pro/custom_text_field_pro.dart';
void main() => runApp(const ExampleApp());
class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key});
  @override
  Widget build(BuildContext context) {
    final customTheme = const CustomTextFieldTheme(
      borderColor: Colors.grey,
      focusedBorderColor: Colors.blue,
      fillColor: Color(0xFFF7F9FB),
      iconColor: Colors.deepPurple,
      titleColor: Color(0xFF202532),
    );
    return MaterialApp(
      title: 'Custom Text Field Pro Demo',
      home: Scaffold(
        appBar: AppBar(title: const Text('CustomTextFieldPro Example')),
        body: Padding(
          padding: const EdgeInsets.all(16),
          child: Column(
            children: [
              CustomTextFieldPro(
                titleText: "Username",
                hintText: "Enter your username",
                theme: customTheme,
              ),
              const SizedBox(height: 16),
              CustomTextFieldPro(
                titleText: "Password",
                hintText: "Enter your password",
                isPassword: true,
                theme: customTheme.copyWith(
                  focusedBorderColor: Colors.deepPurple,
                ),
              ),
              const SizedBox(height: 16),
              CustomTextFieldPro(
                titleText: "Phone Number",
                hintText: "Enter your phone number",
                showCountryCodePicker: true,
                initialCountryCode: '+880',
                inputType: TextInputType.phone,
                theme: customTheme,
              ),
            ],
          ),
        ),
      ),
    );
  }
}
π― Key Features #
| Feature | Description | 
|---|---|
| π Password Mode | Toggle visibility for secure inputs | 
| π± Country Picker | Optional dropdown for phone fields | 
| π¨ Custom Theme | Control all colors globally | 
| β¨ Icons | Add prefix & suffix icons easily | 
| π§© Reusable | Consistent design across app | 
π§± Theme Customization #
Create your global theme once:
const customTheme = CustomTextFieldTheme(
  borderColor: Colors.grey,
  focusedBorderColor: Colors.blue,
  fillColor: Colors.white,
  iconColor: Colors.deepPurple,
  titleColor: Colors.black,
);
Then reuse or override anywhere:
theme: customTheme.copyWith(
  focusedBorderColor: Colors.green,
  iconColor: Colors.green,
),
π‘ Suffix & Prefix Examples #
CustomTextFieldPro(
  titleText: "Email",
  hintText: "example@gmail.com",
  prefixIcon: Icons.email_outlined,
  suffixIcon: Icons.check_circle_outline,
  theme: customTheme,
);
π With Country Code Picker #
CustomTextFieldPro(
  titleText: "Phone",
  hintText: "Enter your phone number",
  showCountryCodePicker: true,
  initialCountryCode: '+1',
  theme: customTheme,
);
π§ Tip: Make it Global #
You can create your theme in a separate Dart file, for example:
// theme/custom_text_field_theme.dart
import 'package:custom_text_field_pro/custom_text_field_pro.dart';
import 'package:flutter/material.dart';
const customTextFieldTheme = CustomTextFieldTheme(
  borderColor: Colors.grey,
  focusedBorderColor: Colors.blue,
  fillColor: Color(0xFFF7F9FB),
  iconColor: Colors.deepPurple,
  titleColor: Color(0xFF202532),
);
Then use anywhere:
import 'theme/custom_text_field_theme.dart';
CustomTextFieldPro(
  titleText: "Password",
  hintText: "Enter password",
  isPassword: true,
  theme: customTextFieldTheme,
);
π§© Parameters Overview #
| Parameter | Type | Description | 
|---|---|---|
titleText | 
String | 
Optional title text above input | 
labelText | 
String | 
Label for text field | 
hintText | 
String | 
Placeholder text | 
isPassword | 
bool | 
Enables password toggle | 
prefixIcon | 
IconData | 
Icon before text | 
suffixIcon | 
IconData | 
Icon after text | 
onSuffixTap | 
VoidCallback | 
Callback on suffix tap | 
showCountryCodePicker | 
bool | 
Enables country picker | 
initialCountryCode | 
String | 
Default country code | 
theme | 
CustomTextFieldTheme | 
Global color & style config | 
π¨ Troubleshooting #
πΉ "No country picker showing?" #
Ensure you have imported the required picker dependency if used.
πΉ "Theme not applying?" #
Check that you passed theme: customTheme to the widget.
π License #
MIT - See LICENSE for details.
Made with β€οΈ by Md. Asikuzzaman GitHub: https://github.com/Asik-Zaman