text_field_validation 1.1.4 copy "text_field_validation: ^1.1.4" to clipboard
text_field_validation: ^1.1.4 copied to clipboard

A Flutter project for creating and managing text field validations with ease.

example/example.dart

import 'package:flutter/material.dart';
import 'package:text_field_validation/src/validation/text_field_validation.dart';

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

class MyApp extends StatelessWidget {
  MyApp({super.key});

  final _keyForm = GlobalKey<FormState>();
  final _controller = TextEditingController();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Text Field Validation',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: SafeArea(
        child: Scaffold(
            body: Center(
          child: Form(
            key: _keyForm,
            autovalidateMode: AutovalidateMode.onUserInteraction,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                SizedBox(
                  width: 300,
                  child: TextFormField(
                    controller: _controller,
                    validator: (name) => TextFieldValidation.name(name!),
                  ),
                )
              ],
            ),
          ),
        )),
      ),
    );
  }
}
2
likes
160
points
56
downloads

Publisher

verified publisherjhonacode.com

Weekly Downloads

A Flutter project for creating and managing text field validations with ease.

Homepage
Repository (GitHub)

Documentation

API reference

License

MIT (license)

More

Packages that depend on text_field_validation