flutter_easyform_builder 0.0.1

SDKflutter
Platformandroidioswindowslinuxmacosweb

A Flutter package for creating beautiful forms with minimal code. Supports various field types (text, email, password, number, alphanum, datepicker) with built-in validation and extensive customization options.

Easy Forms

A Flutter package that simplifies form creation with ready-to-use form fields. Create beautiful forms with minimal code!

Features

  • Multiple Field Types: text, alphanum, number, email, password, datepicker
  • Built-in Validation: Each field type comes with appropriate validation
  • Minimal Code: Create forms with just one line per field
  • Customizable: Extensive customization options available
  • Ready to Use: Import and start using immediately

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  easy_forms: ^1.0.0

Then run:

flutter pub get

Quick Start

import 'package:flutter/material.dart';
import 'package:easy_forms/easy_forms.dart';

class MyForm extends StatelessWidget {
  final _formKey = GlobalKey<FormState>();

  @override
  Widget build(BuildContext context) {
    return Form(
      key: _formKey,
      child: Column(
        children: [
          // Text field (default)
          EasyFormField(label: 'Name'),

          // Email field with validation
          EasyFormField(
            label: 'Email',
            fieldType: FieldType.email,
          ),

          // Password field with hide/show
          EasyFormField(
            label: 'Password',
            fieldType: FieldType.password,
          ),

          // Number field
          EasyFormField(
            label: 'Phone',
            fieldType: FieldType.number,
          ),

          // Alphanumeric field
          EasyFormField(
            label: 'Username',
            fieldType: FieldType.alphanum,
          ),

          // Date picker
          EasyFormField(
            label: 'Date of Birth',
            fieldType: FieldType.datepicker,
          ),
        ],
      ),
    );
  }
}

Field Types

TypeDescriptionValidation
FieldType.textDefault text inputRequired field validation
FieldType.alphanumLetters and numbers onlyAlphanumeric validation
FieldType.numberNumeric inputNumber validation
FieldType.emailEmail input with keyboardEmail format validation
FieldType.passwordPassword with hide/showMinimum length validation
FieldType.datepickerDate selectionDate selection validation

Customization

EasyFormField(
  label: 'Custom Field',
  fieldType: FieldType.email,
  hintText: 'Custom hint text',
  required: false,
  prefixIcon: Icons.person,
  filled: true,
  fillColor: Colors.grey[100],
  onChanged: (value) => print('Changed: $value'),
  validator: (value) => value?.isEmpty ?? true ? 'Required!' : null,
)

Properties

  • label: Field label (required)
  • fieldType: Type of field (defaults to text)
  • controller: TextEditingController
  • validator: Custom validation function
  • hintText: Placeholder text
  • required: Whether field is required (default: true)
  • prefixIcon & suffixIcon: Icons
  • onChanged: Callback for value changes
  • enabled: Enable/disable field
  • filled: Fill background
  • fillColor: Background color

License

MIT License