uniform 2.0.5 copy "uniform: ^2.0.5" to clipboard
uniform: ^2.0.5 copied to clipboard

A lightweight form library for Flutter that handles form validation and state management gracefully, with unified form representation.

BSD-3 License Website Connect with Acme Software on Linkedin Twitter Follow Facebook Instagram

A form library for Flutter that handles form validation and state management gracefully,
with unified form representation.


Uniform handles the repetitive and annoying stuffโ€”keeping track of values/errors/visited fields, orchestrating validation, and handling submission.

Features #

  • ๐Ÿชถ Lightweight & extensive.
  • ๐ŸŽฎ Unified form representation using controllers.
  • ๐Ÿ”„ Easy and customizable form validation API.
  • ๐Ÿ”ง Built-in support for form submission and state management.
  • ๐Ÿ› ๏ธ Builders for quickly creating form fields.
  • ๐Ÿš€ Compatible with any state management solution or vanilla Flutter States.
  • ๐Ÿ”’ Supports for global and local validators.

Getting started #

See the Installing section. No extra configurations needed.

Usage #

Note: Detailed Usage documentation is coming soon. For now, please refer to the example for more details.

final formController = FormController(
  validators: {const InputFieldValidator.required()},
);

TextFieldController.create(formController, tag: 'email')
  ..setValidators({const EmailInputFieldValidator()});

FieldController<bool>.create(formController, tag: 'remember_me', autoValidate: true)
  ..setInitialValue(false)
  ..setValidators({const PasswordInputFieldValidator()});

InputForm(
  controller: formController,
  child: Column(
    children: [
      TextInputFieldBuilder(
        tag: 'email',
        builder: (_, controller, textController) {
          return TextFormField(
            controller: textController,
            decoration: InputDecoration(
              hintText: 'Email Address',
              errorText: controller.error.message,
            ),
            enabled: !controller.isSubmitted,
            onChanged: controller.onChanged,
          );
        },
      ),
      const SizedBox(height: 16),
      InputFieldBuilder<bool>(
        tag: 'remember_me',
        builder: (context, controller, _) {
          return CheckboxListTile(
            title: const Text('Remember Me'),
            value: controller.value,
            controlAffinity: ListTileControlAffinity.leading,
            enabled: !controller.isSubmitted,
            onChanged: controller.onChanged,
          );
        },
      ),
      const SizedBox(height: 40),
      FilledButton(
        onPressed: () {
          if(formController.validate()){
            print('Form Submitted!');
          }
        },
        child: const Text('Submit'),
      ),
    ],
  ),
),
10
likes
140
pub points
71%
popularity
screenshot

Publisher

verified publisheracmesoftware.com

A lightweight form library for Flutter that handles form validation and state management gracefully, with unified form representation.

Homepage
Repository (GitHub)
View/report issues

Topics

#form #validation #reactive #forms

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on uniform