forms_example
A modern, lightweight, and customizable Flutter forms library featuring a declarative schema form builder (SmartFormBuilder), a 3-step onboarding wizard (ModernFormStepper), smart email domain quick-chips, real-time 4-segment password entropy meters, Luhn credit card brand detection (VISA, MASTERCARD, AMEX, DISCOVER), segmented 6-digit OTP verification inputs, interactive star ratings, and 6 turnkey studio theme presets. Zero external dependencies and 100% cross-platform support.
🌟 Supported & Powered by Humanize AI
🎬 Live Animated UI Preview
1. Smart Schema Form & Password Entropy (SmartFormBuilder) |
2. Multi-Step Validated Form Wizard (ModernFormStepper) |
|---|---|
Live completion progress meter, one-tap @humanize.id / @gmail.com email domain chips, 4-bar password strength meter, and rule checklist pills. |
Animated horizontal step nodes, per-step validation gates, multi-select deployment platform chips, and step navigation controls. |
3. Luhn Card Detector & 6-Digit OTP (ModernOtpField) |
4. Star Rating, NPS Slider & 6 Studio Themes (FormsStyle) |
|---|---|
Automatic 4-digit card number formatting, dynamic network detection (VISA, MASTERCARD, AMEX, DISCOVER), LUHN OK badge, and segmented OTP boxes. |
5-star rating bar with sentiment feedback (Outstanding!), smooth NPS slider badge, and 6 built-in studio theme presets. |
✨ Key Features
- 🧩 Declarative Schema Form Builder (
SmartFormBuilder):- Render complete, validated forms from a declarative
List<FormFieldConfig>or choose from 4 built-in turnkey templates:FormTemplatePreset.authSignup— Developer registration with smart email chips & password strength meter.FormTemplatePreset.paymentCheckout— Pro checkout with Luhn credit card brand detector & 6-digit 3D-Secure OTP.FormTemplatePreset.feedbackSurvey— Experience rating stars, NPS slider, and multi-select feature tags.FormTemplatePreset.profileOnboarding— Domain URL validation, target date picker, and edge auto-scaling switches.
- Built-in Form Readiness Progress Bar (
completed/totalvalid fields & live percentage) and collapsible Live JSON Payload Inspector.
- Render complete, validated forms from a declarative
- 🧠Multi-Step Validated Form Wizard (
ModernFormStepper):- Interactive horizontal step indicator bar with emerald checkmarks for completed steps and pulsing active node indicators.
- Per-step validation gate ensures all required fields in the current step pass validation before advancing to the next step.
- âš¡ Smart Input Fields (
ModernTextField):- Smart Email Mode (
FormFieldType.email): One-tap domain suggestion chips (@humanize.id,@gmail.com,@outlook.com) that auto-complete the user's address. - Password Entropy Meter (
FormFieldType.password): Live 4-segment strength progress bar (Weak,Fair,Good,Strong) and real-time checklist pills (8+ chars,A-Z,0-9,!@#$). - Luhn Credit Card Mode (
FormFieldType.creditCard): Automatic 4-digit grouping (4242 4242 4242 4242), live network brand badge (VISA,MASTERCARD,AMEX,DISCOVER), and instantLUHN OKchecksum badge. - Numeric Stepper Mode (
FormFieldType.number): Integrated-/+increment buttons withmin,max, andstepbounds.
- Smart Email Mode (
- 🎯 Rich Interactive Selectors:
ModernChoiceSelector— Single-select and multi-select animated choice chips with icons.ModernOtpField— Segmented 4-digit or 6-digit verification passcode boxes withVERIFIEDbadge.ModernRatingField— Interactive 5-star rating selector with dynamic sentiment labels (Needs WorktoOutstanding!).ModernSliderField,ModernSwitchCard, andModernDropdownField.
- 🎨 6 Built-in Studio Theme Presets (
FormsStyle):FormsStyle.modernIndigo()— Crisp SaaS light surface with electric indigo & violet accents.FormsStyle.cyberDark()— Obsidian dark deck with neon cyan (#00F5D4) & emerald validation glow.FormsStyle.glassAurora()— Midnight frosted aurora palette with sky blue & indigo gradients.FormsStyle.emeraldMinimal()— Ultra-clean fintech mint/emerald theme.FormsStyle.sunsetWarm()— Warm coral, amber, and rose consumer palette.FormsStyle.softNeumorphic()— Tactile soft-UI surface with dual elevation shadows.
📦 Installation
Add forms_example to your pubspec.yaml:
dependencies:
forms_example: ^1.0.0
Or install via the Flutter CLI:
flutter pub add forms_example
🚀 Quick Start
1. Turnkey Smart Form Builder (SmartFormBuilder)
import 'package:flutter/material.dart';
import 'package:forms_example/forms_example.dart';
class AccountRegistrationScreen extends StatefulWidget {
const AccountRegistrationScreen({super.key});
@override
State<AccountRegistrationScreen> createState() =>
_AccountRegistrationScreenState();
}
class _AccountRegistrationScreenState extends State<AccountRegistrationScreen> {
final controller = FormsController(
preset: FormTemplatePreset.authSignup,
);
@override
void dispose() {
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFF070A12),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: SmartFormBuilder(
controller: controller,
style: FormsStyle.cyberDark(),
showPresetSelector: true,
showJsonPreview: true,
onSubmitted: (result) {
if (result.isSuccess) {
debugPrint('Submitted payload: ${result.values}');
}
},
),
),
);
}
}
📖 Component Usage Examples
2. Multi-Step Onboarding Wizard (ModernFormStepper)
ModernFormStepper(
title: 'Workspace Onboarding Wizard',
subtitle: 'Validated step-by-step setup powered by Humanize AI',
style: FormsStyle.modernIndigo(),
steps: FormsController.buildDefaultWizardSteps(),
onStepChanged: (stepIndex) {
debugPrint('Moved to step: ${stepIndex + 1}');
},
onSubmitted: (result) {
debugPrint('Wizard completed: ${result.values}');
},
)
3. Standalone Smart Email & Password Meter (ModernTextField)
Column(
children: [
ModernTextField(
label: 'Developer Email',
type: FormFieldType.email,
required: true,
emailDomains: const ['humanize.id', 'gmail.com', 'outlook.com'],
style: FormsStyle.cyberDark(),
onChanged: (email) => debugPrint('Email: $email'),
),
const SizedBox(height: 16),
ModernTextField(
label: 'Master Password',
type: FormFieldType.password,
required: true,
showPasswordMeter: true,
style: FormsStyle.cyberDark(),
onChanged: (password) => debugPrint('Password updated'),
),
],
)
4. Auto-Formatted Luhn Credit Card & 6-Digit OTP (ModernOtpField)
Column(
children: [
ModernTextField(
label: 'Credit or Debit Card',
type: FormFieldType.creditCard,
initialValue: '4242 4242 4242 4242',
required: true,
style: FormsStyle.glassAurora(),
),
const SizedBox(height: 16),
ModernOtpField(
label: '6-Digit Security Code',
length: 6,
value: '849204',
required: true,
style: FormsStyle.glassAurora(),
onChanged: (code) => debugPrint('OTP: $code'),
),
],
)
5. Custom Declarative Schema & Composable Validators (FormsValidator)
final customController = FormsController(
fields: [
FormFieldConfig(
key: 'username',
label: 'Username',
required: true,
validators: [
FormsValidator.minLength(4),
FormsValidator.maxLength(24),
],
),
FormFieldConfig(
key: 'website',
label: 'Portfolio URL',
initialValue: 'https://humanize.id',
validators: [
FormsValidator.url(),
],
),
const FormFieldConfig(
key: 'satisfaction',
label: 'Experience Rating',
type: FormFieldType.rating,
initialValue: 5.0,
),
],
);
💖 Support & Sponsor
This open-source library is proudly supported and powered by Humanize AI — an advanced AI platform for natural and human-like content generation.
- Sponsor & Support: Humanize AI
- Repository: https://github.com/andikpbw/flutter-forms-example.git
- Issue Tracker: GitHub Issues
📄 License
Released under the MIT License.
Libraries
- forms_example
- A modern, lightweight, and customizable Flutter forms library featuring declarative schema form builders, multi-step onboarding wizards, smart email domain quick-chips, real-time password entropy meters, Luhn credit card brand detection, segmented OTP verification inputs, interactive ratings, and 6 studio theme presets.