textfieldpackages 0.0.1
textfieldpackages: ^0.0.1 copied to clipboard
A customizable and feature-rich TextField widget for Flutter applications with built-in validation, styling, and accessibility features.
CustomTextField Package #
A highly customizable TextField widget for Flutter applications that extends the functionality of Flutter's default TextField.
Features #
- 🎨 Customizable border style, radius, and color
- 🔄 Optional clear button
- 🎯 Background color customization
- 🔒 Built-in support for password fields
- 📝 Multiline text support
- 🎭 Fully customizable text styling
- 💫 Easy to use with simple API
- 📱 Responsive and adaptive design
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
textfieldpackages: ^0.0.1
Usage #
Import the package:
import 'package:textfieldpackages/textfieldpackages.dart';
Basic Usage #
CustomTextField(
hintText: 'Enter some text',
labelText: 'Basic TextField',
showClearButton: true,
onChanged: (value) {
print('Text changed: $value');
},
)
Password Field #
CustomTextField(
hintText: 'Enter password',
labelText: 'Password',
obscureText: true,
borderRadius: 12.0,
borderColor: Colors.purple,
backgroundColor: Colors.purple.withOpacity(0.1),
suffixIcon: IconButton(
icon: Icon(_obscureText ? Icons.visibility : Icons.visibility_off),
onPressed: () {
setState(() {
_obscureText = !_obscureText;
});
},
),
)
Email Field with Validation #
CustomTextField(
hintText: 'Enter email',
labelText: 'Email',
keyboardType: TextInputType.emailAddress,
borderColor: Colors.blue,
backgroundColor: Colors.blue.withOpacity(0.1),
onSubmitted: (value) {
if (!value.contains('@')) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Please enter a valid email')),
);
}
},
)
Multiline TextField #
CustomTextField(
hintText: 'Enter multiple lines',
labelText: 'Notes',
maxLines: 5,
borderRadius: 8.0,
borderColor: Colors.green,
backgroundColor: Colors.green.withOpacity(0.1),
)
Properties #
| Property | Type | Description |
|---|---|---|
| controller | TextEditingController? | Controls the text being edited |
| hintText | String? | Placeholder text |
| labelText | String? | Label displayed above the field |
| borderStyle | BorderStyle | Style of the border |
| borderRadius | double | Radius of the border corners |
| borderColor | Color | Color of the border |
| backgroundColor | Color? | Background color of the field |
| showClearButton | bool | Whether to show a clear button |
| onChanged | ValueChanged | Callback when text changes |
| onSubmitted | ValueChanged | Callback when text is submitted |
| keyboardType | TextInputType? | Type of keyboard to display |
| obscureText | bool | Whether to hide the text (for passwords) |
| maxLines | int? | Maximum number of lines |
| minLines | int? | Minimum number of lines |
| textStyle | TextStyle? | Style for the input text |
| suffixIcon | Widget? | Custom suffix icon widget |
Contributing #
Contributions are welcome! Here's how you can help:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Please make sure to update tests as appropriate.
Roadmap #
- ❌ Add form validation support
- ❌ Add more preset styles (Material 3, iOS style)
- ❌ Add RTL (Right-to-Left) support
- ❌ Enhance accessibility features
- ❌ Add theme support
- ❌ Add custom error styles
- ❌ Add input formatters
- ❌ Add autocomplete support
License #
MIT License - see the LICENSE file for details
Support #
If you find this package helpful, please give it a star ⭐️ on GitHub!