validation_form 0.0.7 copy "validation_form: ^0.0.7" to clipboard
validation_form: ^0.0.7 copied to clipboard

Reactive Forms heavily inspire this model-driven approach to handling form inputs and validations.

example/lib/main.dart

import 'package:example/login.dart';
import 'package:example/profile.dart';
import 'package:flutter/material.dart';
import 'package:validation_form/validation_form.dart';

void main() => runApp(MaterialApp(title: 'Flutter Demo', home: const Home()));

class Home extends StatefulWidget {
  const Home({super.key});

  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {
  @override
  void initState() {
    ValidationMessages.messages = {
      ValidationNames.required: (attribute, [_ = const []]) {
        return 'The $attribute field is must be required field';
      }
    };

    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: [
            ElevatedButton(
              child: const Text('Login'),
              onPressed: () {
                Navigator.of(context).push(
                    MaterialPageRoute(builder: (context) => const Login()));
              },
            ),
            ElevatedButton(
              child: const Text('Profile'),
              onPressed: () {
                Navigator.of(context).push(
                    MaterialPageRoute(builder: (context) => const Profile()));
              },
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
135
points
42
downloads

Publisher

unverified uploader

Weekly Downloads

Reactive Forms heavily inspire this model-driven approach to handling form inputs and validations.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

email_validator, equatable, flutter, flutter_bloc, phone_numbers_parser

More

Packages that depend on validation_form