validation_form 0.0.5 copy "validation_form: ^0.0.5" to clipboard
validation_form: ^0.0.5 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(ValidationMessages(
    messages: {
      ValidationNames.required: (attribute, [_ = const []]) {
        return 'The $attribute field is must be required';
      }
    },
    child: MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(primarySwatch: Colors.blue),
      home: const Home(),
    ),
  ));
}

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

  @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
0
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

License

unknown (license)

Dependencies

email_validator, equatable, flutter, flutter_bloc, phone_numbers_parser

More

Packages that depend on validation_form