easy_textformfield 0.0.1 copy "easy_textformfield: ^0.0.1" to clipboard
easy_textformfield: ^0.0.1 copied to clipboard

Flutter package for easy text form field with validation and error message handling.

example/example.dart

import 'package:easy_textformfield/TextFields/Default/Implementation/Prefix/Implementation/imports_prefix.dart';
import 'package:easy_textformfield/TextFields/Default/Implementation/Text/Implementation/imports_text.dart';
import 'package:easy_textformfield/TextFields/Options/imports_options.dart';
import 'package:easy_textformfield/Validation/Implementation/PasswordValidator/password_validator.dart';
import 'package:easy_textformfield/Validation/Implementation/PhoneValidator/phone_validator.dart';
import 'package:easy_textformfield/easy_textformfield.dart';
import 'package:flutter/material.dart';

void main() {
  return runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      title: "Testing Easy Text Form Field",
      home: LoginPage(),
    );
  }
}

class LoginPage extends StatefulWidget {
  const LoginPage({Key? key}) : super(key: key);

  @override
  State<LoginPage> createState() => _LoginPageState();
}

class _LoginPageState extends State<LoginPage> {
  final GlobalKey<FormState> formKey = GlobalKey<FormState>();
  final TextEditingController phoneController = TextEditingController();
  final TextEditingController passwordController = TextEditingController();

  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    phoneController.dispose();
    passwordController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    var node = FocusScope.of(context);
    return Scaffold(
      appBar: AppBar(
        title: const Text("Testing Easy Text Form Field"),
      ),
      body: SingleChildScrollView(
        child: Form(
          key: formKey,
          child: Padding(
            padding: const EdgeInsets.symmetric(
              horizontal: 16,
            ),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                const SizedBox(height: 24),
                Text("Hello again",
                    style: Theme.of(context).textTheme.headline6),
                const SizedBox(height: 34),
                Text("Enter your phone number and password",
                    style: Theme.of(context).textTheme.subtitle1),
                const SizedBox(height: 34),
                EasyTextFormField(
                  hint: const TFFHint(
                    title: 'your phone number',
                  ),
                  header: const TFFHeader(title: 'phone number'),
                  prefix: PrefixWithIconData(iconData: Icons.phone_android,),
                  validation: PhoneValidator.instance.validate,
                  controller:  phoneController,
                  onComplete: () {
                    node.nextFocus();
                  },
                ),
                const SizedBox(height: 24),
                EasyTextFormField(
                  hint: const TFFHint(
                    title: 'كلمة المرور',
                  ),
                  header: const TFFHeader(title: 'كلمة المرور'),
                  prefix: PrefixWithIconData(iconData: Icons.lock,),
                  validation: PasswordValidator.instance.validate,
                  secureType: SecureType.Toggle,
                  controller:  passwordController,
                  onComplete: () {
                    node.unfocus();
                  /// login fun called here
                  },
                ),

              ],
            ),
          ),
        ),
      ),
    );
  }
}
3
likes
120
points
18
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter package for easy text form field with validation and error message handling.

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on easy_textformfield