well_formed 0.4.0
well_formed: ^0.4.0 copied to clipboard

A form fields package designed to relieve developers of much of the burden of form-related coding. It provides field masking, validation, smart trimming, and more.

example/lib/main.dart

import 'package:eo_color/eo_color.dart';
import 'package:flutter/material.dart';
import 'package:well_formed/well_formed.dart';

void main() {
  runApp(const _DemoApp());
}

/// Demo purposes form app widget.
class _DemoApp extends StatelessWidget {
  /// Ctor.
  const _DemoApp({Key? key}) : super(key: key);

  static final _labelStyle = TextStyle(color: const Grey.veryDark().color);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Simple form demo',
      home: Scaffold(
        appBar: AppBar(
          backgroundColor: const Cyan().color,
          elevation: 0.0,
          title: const Text('Well_formed demo app'),
        ),
        body: Center(
          child: SizedBox(
            width: 350,
            child: WellFormed.btn([
              DigitField.len(
                5,
                diff: 'Please enter exactly 5 digits; for example, "22335".',
                blank: 'Please enter the 5 digits.',
                decoration: InputDecoration(
                  labelText: 'Enter 5 digits',
                  labelStyle: _labelStyle,
                ),
              ),
              IntField.pos(
                blank: 'Please enter a positive integer',
                decoration: InputDecoration(
                  labelText: 'Enter a positive interger',
                  labelStyle: _labelStyle,
                ),
              ),
              EmailField.len(
                50,
                blank: 'Please inform the email address.',
                long: 'The email is too long',
                decoration: InputDecoration(
                  labelText: 'Enter an email with up to 50 characters',
                  labelStyle: _labelStyle,
                ),
              ),
              CpfField(
                blank: 'A CPF value is required.',
                malformed: 'Invalid CPF',
                decoration: InputDecoration(
                  labelText: 'Enter a CPF',
                  hintText: '999.999.999-99',
                  labelStyle: _labelStyle,
                ),
              ),
            ]),
          ),
        ),
      ),
    );
  }
}
9
likes
130
pub points
13%
popularity

Publisher

dartoos.dev

A form fields package designed to relieve developers of much of the burden of form-related coding. It provides field masking, validation, smart trimming, and more.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, formdator, mask_text_input_formatter

More

Packages that depend on well_formed