📝 Turbo Forms

Pub Version License: BSD-3-Clause GitHub Stars

Turbo Forms is a comprehensive form configuration and validation system for Flutter applications. It provides a type-safe, reactive approach to building and managing forms with built-in validation, state management, and UI components.

Features

  • Type-Safe Forms: Strongly typed form fields with generic support
  • Reactive State Management: Built on turbo_notifiers for reactive form state
  • Built-in Validators: Common validators for email, required fields, and more
  • Custom Validators: Easy-to-create custom validation logic
  • Multiple Field Types: Support for text input, select, checkbox, color picker, and more
  • Form Field Builders: Flexible widget builders for custom UI rendering

Installation

Add turbo_forms to your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  turbo_forms: ^1.0.0

Then run:

flutter pub get

Usage

import 'package:turbo_forms/turbo_forms.dart';

// Create a form field configuration
final emailField = TurboFormFieldConfig<String>(
  fieldType: TurboFieldType.textInput,
  id: 'email',
  valueValidator: (value) {
    if (value == null || value.isEmpty) {
      return 'Email is required';
    }
    if (!EmailValidator.validate(value)) {
      return 'Invalid email format';
    }
    return null;
  },
);

// Use in a widget
TurboFormField<String>(
  fieldConfig: emailField,
  builder: (context, fieldConfig, child) {
    return TextFormField(
      onChanged: (value) => fieldConfig.update(value),
      validator: fieldConfig.value.valueValidator,
    );
  },
)

Example

Check the /example directory for a complete Flutter application demonstrating Turbo Forms features.

Contributing

Contributions are welcome! Please open issues or pull requests on our GitHub repository.

License

This package is licensed under the BSD 3-Clause License. See the LICENSE file for details.

Libraries

turbo_forms