Bond Form

The bond_form package provides a robust and flexible solution to manage form state in Flutter applications. It introduces several classes and utilities that simplify the process of validation, submission, and error handling in forms.

This package is ideal for anyone looking to streamline their form management logic, whether it's for a simple login form or a complex, multi-step registration process.

Pub Version License: MIT

Table of Contents

Features

  • Easy to use API for form management
  • Built-in validation logic
  • Customizable form fields
  • Reactive state management
  • Support for async form submission
  • Easily extensible

Installation

To use bond_form, simply add it as a dependency in your pubspec.yaml:

dependencies:
  bond_form: ^0.0.1

if you want to use the riverpod integration, add the following dependency:

dependencies:
  bond_form_riverpod: ^0.0.1

and no need to add the bond_form dependency, it will be added automatically.

Usage:


final loginForm = BondFormState<String, Error>(
  fields: {
    'email': TextFieldState(
      null,
      label: 'Email',
      rules: [
        Rules.required(),
        Rules.email(),
      ],
    ),
    'password': TextFieldState(
      null,
      label: 'Password',
      rules: [
        Rules.required(),
        Rules.minLength(8),
      ],
    ),
  },
);

final loginController = LogiFormController();

void main() {
  // Update the form fields
  loginController.updateText('email', 'salahnahed@icloud.com');
  loginController.updateText('password', 'password123');

// Print the updated values
  print('Email value: ${loginForm.textFieldValue('email')}');
  print('Password value: ${loginForm.textFieldValue('password')}');

// Let's assume we want to submit the form now
  loginController.submit();
}

Documentation

For a comprehensive guide on how to use form_bond, please refer to the full documentation available in the bond_docs repository under the forms.md file.

Read Full Documentation Here

Contributing

Contributions are welcome! However, we currently do not have a set guideline for contributions. If you're interested in contributing, please feel free to open a pull request or issue, and we'll be happy to discuss and review your changes.

License

Bond Core is licensed under the MIT License.

Libraries

bond_form
A library for working with forms and form validation.
l10n/messages_all
l10n/messages_all_locales
l10n/messages_ar
l10n/messages_en
validator_localizations