auto_validate 1.0.3 copy "auto_validate: ^1.0.3" to clipboard
auto_validate: ^1.0.3 copied to clipboard

outdated

Auto Validate Package. This package will help you to auto validate used regular expressions. No need to write the code by yourself, simply you can use this package for not waste time and it will help [...]

example/README.md

Auto Validate Example #

Form Validator Usage #

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

/// Created By Mahmoud El Shenawy (Dev.Mahmoud.ElShenawy@Gmail.com)

void main() => runApp(AutoValidateApp());

class AutoValidateApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Auto Validate Package',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text("Auto Validate"),
        ),
        body: AutoValidateHome(),
      ),
    );
  }
}

class AutoValidateHome extends StatelessWidget {
  final TextEditingController passwordController = TextEditingController();
  final TextEditingController passwordStrongController = TextEditingController();
  final TextEditingController emailController = TextEditingController();
  final TextEditingController phoneController = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Padding(
          padding: const EdgeInsets.symmetric(
            vertical: 15.0,
            horizontal: 12.5,
          ),
          child: Column(
            children: [
              Flexible(flex: 5, child: FlutterLogo(size: 200)),
              Flexible(
                flex: 7,
                child: new Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 2.0),
                      child: TextFormField(
                        controller: emailController,
                        decoration: InputDecoration(
                          hintText: "Email",
                          border: OutlineInputBorder(
                            borderSide: BorderSide(),
                          ),
                        ),
                        validator: FormValidator.email(
                          errorMessage: 'Please Enter Valid Email',
                        ),
                      ),
                    ),
                    SizedBox(
                      height: 5,
                    ),
                    Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 2.0),
                      child: TextFormField(
                        controller: passwordController,
                        decoration: InputDecoration(
                          hintText: "Password",
                          border: OutlineInputBorder(
                            borderSide: BorderSide(),
                          ),
                        ),
                        validator: FormValidator.password(
                          errorMessage: 'Please Enter Valid Password',
                        ),
                      ),
                    ),
                    SizedBox(
                      height: 5,
                    ),
                    Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 2.0),
                      child: TextFormField(
                        controller: passwordStrongController,
                        decoration: InputDecoration(
                          hintText: "Password",
                          border: OutlineInputBorder(
                            borderSide: BorderSide(),
                          ),
                        ),
                        validator: FormValidator.minLength(
                            errorMessage:
                                'Please Enter Valid Password At Least 5 Length',
                            minLength: 5),
                      ),
                    ),
                    SizedBox(
                      height: 5,
                    ),
                    Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 2.0),
                      child: TextFormField(
                        controller: passwordStrongController,
                        decoration: InputDecoration(
                          hintText: "Phone",
                          border: OutlineInputBorder(
                            borderSide: BorderSide(),
                          ),
                        ),
                        validator: FormValidator.phone(
                          errorMessage: 'Please Enter Valid Phone',
                        ),
                      ),
                    ),
                    SizedBox(
                      height: 5,
                    ),
                    Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 2.0),
                      child: TextFormField(
                        controller: passwordStrongController,
                        decoration: InputDecoration(
                          hintText: "Strong Password",
                          border: OutlineInputBorder(
                            borderSide: BorderSide(),
                          ),
                        ),
                        validator: FormValidator.passwordStrong(
                            errorMessage: 'Please Enter Valid Strong Password'),
                      ),
                    ),
                    SizedBox(
                      height: 5,
                    ),
                  ],
                ),
              )
            ],
          ),
        ),
      ],
    );
  }
}

Auto Validate Usage #

import 'package:auto_validate/auto_validate.dart';

/// Created By Mahmoud El Shenawy (Dev.Mahmoud.ElShenawy@Gmail.com)

class AutoValidateExample {
  validation() {
    var email = 'Dev.Mahmoud.ElShenawy@gmail.com';
    var name = 'Mahmud El Shenawy';
    var password = '@MahmoudElShenawy2021';
    var phone = '+201098415860';

    AutoValidate.email(email.toString())
        ? print('Email is Valid')
        : print('Email is Invalid');

    AutoValidate.userName(name.toString())
        ? print('User Name is Valid')
        : print('User Name is Invalid');

    AutoValidate.password(password.toString())
        ? print('Password is Valid')
        : print('Password is Invalid');

    AutoValidate.phone(phone.toString())
        ? print('Phone is Valid')
        : print('Phone is Invalid');
  }
}
60
likes
0
points
125
downloads

Publisher

unverified uploader

Weekly Downloads

Auto Validate Package. This package will help you to auto validate used regular expressions. No need to write the code by yourself, simply you can use this package for not waste time and it will help you a lot.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

dartdoc, flutter, freezed_annotation

More

Packages that depend on auto_validate