๐ฆ Zeba Academy Form Validator
A powerful, lightweight, and reusable form validation package for Flutter with clean architecture and Zeba Academy branding.
Built to simplify validation logic while keeping your codebase clean, scalable, and production-ready.
โจ Features
โ Email, Password, Phone, and Name validators
โ Clean and reusable validation functions
โ Custom error messages with Zeba Academy branding
โ Combine multiple validators easily
โ Seamless integration with TextFormField
โ Auto focus on first invalid field
โ Developer-friendly API
โ Zero bloat, high performance
๐ Installation
Add this to your pubspec.yaml:
dependencies:
zeba_academy_form_validator: ^1.0.0
Then run:
flutter pub get
๐ Usage
1๏ธโฃ Import Package
import 'package:zeba_academy_form_validator/zeba_academy_form_validator.dart';
2๏ธโฃ Basic Validators
TextFormField(
decoration: InputDecoration(labelText: "Email"),
validator: ZebaValidators.email,
)
TextFormField(
decoration: InputDecoration(labelText: "Password"),
validator: ZebaValidators.password,
)
3๏ธโฃ Combine Multiple Validators
validator: ZebaValidatorBuilder.combine([
ZebaValidators.password,
(value) =>
value != null && value.contains("123")
? "Zeba Academy: Weak password"
: null,
])
4๏ธโฃ Form Validation with Auto Focus
final _formKey = GlobalKey<FormState>();
final emailFocus = FocusNode();
final passwordFocus = FocusNode();
ElevatedButton(
onPressed: () {
final isValid = ZebaFormHelper.validateAndFocus(
formKey: _formKey,
focusNodes: [emailFocus, passwordFocus],
);
if (isValid) {
print("Form is valid ๐");
}
},
child: Text("Submit"),
)
๐ง Available Validators
| Validator | Description |
|---|---|
email |
Validates email format |
password |
Checks minimum length |
phone |
Validates 10-digit phone number |
name |
Ensures non-empty name |
๐จ Custom Messages
All validation messages are pre-branded:
Zeba Academy: Enter a valid email
Zeba Academy: Password is required
You can extend or override them easily.
๐งช Testing
Run tests using:
flutter test
๐ Project Structure
lib/
โโโ zeba_academy_form_validator.dart
โโโ src/
โโโ validators.dart
โโโ messages.dart
โโโ validator_builder.dart
โโโ form_helper.dart
๐ฅ Future Enhancements
- Confirm password validator
- Async validation (API-based)
- Localization support
- Prebuilt UI components
- Advanced validation rules
๐ค Contributing
Contributions are welcome!
- Fork the repo
- Create your feature branch
- Commit your changes
- Open a Pull Request
๐ License
This project is licensed under the GPL License.
๐จโ๐ป About Me
โจ Iโm Sufyan bin Uzayr, an open-source developer passionate about building and sharing meaningful projects. You can learn more about me and my work at sufyanism.com or connect with me on Linkedin
๐ Your all-in-one no-bloat hub!
๐ Explore cutting-edge resources in coding, tech, and development at zeba.academy and code.zeba.academy. Empower yourself with practical skills through curated directives, real-world projects, and hands-on experience. Level up your tech game today! ๐ปโจ
Zeba Academy is a learning platform dedicated to coding, technology, and development.
โก Visit our main site: https://zeba.academy โก Explore courses: https://code.zeba.academy โก YouTube: https://www.youtube.com/@zeba.academy โก Instagram: https://www.instagram.com/zeba.academy/
โค๏ธ Support
If you like this package, give it a โญ on GitHub and share it with others!
Thank you for visiting!