flutter-bloc-forms
Manage form state, validation, and input handling through dedicated FormBlocs. Use when building forms with real-time validation, multi-step flows, or complex input patterns like search debouncing.
Works with
---
name: flutter-bloc-forms
description: Manage form state, validation, and input handling through dedicated FormBlocs. Use when building forms with real-time validation, multi-step flows, or complex input patterns like search debouncing.
license: MIT
---
# Form Architecture with BLoC
- Manage form state in a dedicated `FormBloc` — NOT in widget `setState`
- Each form field maps to a property in the BLoC state
- Validate on field change (real-time) or on submit (batch) depending on UX requirements
- Emit `FormSubmitting`, `FormSuccess`, `FormError` states for submission flow
## Form Events
- `FieldChanged(field, value)` — update a single field in state
- `FormSubmitted` — trigger validation and submission
- `FormReset` — clear all fields and errors
## Form State
- Use a single state class with all field values, field-level errors, and form status:
```dart
sealed class FormStatus { initial, submitting, success, failure }
```
- Field errors: `Map<String, String?>` keyed by field name — `null` means valid
# Validation Patterns
- Validate in the domain layer — NOT in widgets or BLoCs
- Create pure validator functions that return `String?` (null = valid, string = error message):
```dart
String? validateEmail(String value) =>
value.contains('@') ? null : 'Invalid email';
```
- Compose validators: `String? validate(String v) => validateRequired(v) ?? validateEmail(v)`
- Use localized error messages via `context.l10n` — no hardcoded validation strings
# Input Widgets
- Use `TextFormField` with `InputDecoration` for consistent styling
- Always set `textInputAction` for proper keyboard behavior (`next`, `done`)
- Always set `keyboardType` matching the field type (`emailAddress`, `phone`, `number`)
- Use `inputFormatters` to restrict input (e.g., `FilteringTextInputFormatter.digitsOnly`)
- Assign `Key('feature_fieldName')` to every form field for test access
- Use `AutofillHints` for login/signup forms (email, password, name)
- Wrap form fields with `Focus` or `FocusTraversalGroup` for proper tab order
# Controller Lifecycle
- Declare `TextEditingController` as `late final` in `initState()` — dispose in `dispose()`
- Sync controllers to BLoC via `onChanged` callback or controller listener
# Form Submission
- Disable submit button while `FormStatus.submitting` to prevent double-submission
- Show inline field errors below each field — not just a top-level error
- On success: navigate, show success feedback, and reset form if staying on same page
- On failure: show error feedback via `SnackBar` or inline, keep form data intact
# Common Form Patterns
- **Search**: Use `debounce` transformer on search events (300-500ms delay)
- **Multi-step**: Each step is a separate form state within one `FormBloc`, validated independently
- **Dependent fields**: Update dependent field options in `on<FieldChanged>` handler (e.g., country → city)More Mobile skills
animation-vocabulary
emilkowalski/skills
Reverse-lookup glossary that turns a vague description of a web animation or motion effect into its exact term ("the bouncy thing when a popover opens" → Pop in; "the iOS rubber-band scroll" → Rubber-banding). Use when the user asks "what's it called when…", or describes a motion effect without knowing its name and wants the right word to prompt an AI or designer with. For naming an effect, not designing or building one.
xcode-project-setup
firebase/agent-skills
Safely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire).
cross-border-ecommerce
nexscope-ai/ecommerce-skills
Cross-border e-commerce expansion advisor. Scores target markets on 8 weighted dimensions (market size, ecommerce penetration, competition, regulatory complexity, logistics infrastructure, payment ecosystem, cultural distance, IP protection), compares 5 fulfillment models with cost and transit data, provides country-by-country tax/duty compliance guides (EU VAT/IOSS, UK VAT, US sales tax, CA GST, AU GST, JP consumption tax), maps local payment preferences by market, and builds a phased expansion roadmap. No API key required.

