Skip to content

Form Field

Complete form input with label, validation, and error handling.

Installation

bash
flutter_studio add formfield
bash
flutter pub add flutter_studio

Usage

dart
CustomFormField(
  label: 'Email Address',
  placeholder: 'your@email.com',
  helperText: 'We will never share your email',
  validator: (value) {
    if (value?.isEmpty ?? true) {
      return 'Email is required';
    }
    if (!value!.contains('@')) {
      return 'Please enter a valid email';
    }
    return null;
  },
  onChanged: (value) {
    print(value);
  },
)

API Reference

Properties

PropertyTypeDefaultDescription
labelStringrequiredField label
placeholderString?nullPlaceholder text
validatorFunction?nullValidation function
helperTextString?nullHelper text below field