my_formfield 0.0.6 copy "my_formfield: ^0.0.6" to clipboard
my_formfield: ^0.0.6 copied to clipboard

outdated

A customizable widget for easier and better implementation of the textformfield.

MyFormField #

This package provides a customizable and detailed TextFormField widget for creating complex forms in Flutter, with built-in validation and error handling.

Features #

  • Customizable input decoration
  • Built-in validation and error handling

Installation #

Add the following to your pubspec.yaml file:


dependencies:
  my_formfield: ^0.0.6

Then, run flutter pub get in your terminal.

Usage #

To use MyFormField, import the package and create an instance of the widget, specifying the desired properties:


import 'package:my_formfield/my_formfield.dart';


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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Custom FormField'),
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(16.0),
          child: Column(
            children: [
              MyFormField(
                isLabel: true,
                label: 'Full name',
                labelStyle: const TextStyle(fontWeight: FontWeight.w700),
                inputHint: 'Enter full name',
                prefixIcon: const Icon(Icons.person_outline),
                border:
                    OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
              ),
              const SizedBox(height: 20),
              MyFormField(
                isLabel: true,
                label: 'Email',
                labelSpacing: 12,
                inputHint: 'Enter email address',
                prefixIcon: const Icon(Icons.alternate_email),
                border:
                    OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
              ),
              const SizedBox(height: 20),
              MyFormField(
                inputLabel: 'Password',
                label: 'Password',
                inputHint: 'Enter password',
                obscureText: true,
                prefixIcon: const Icon(Icons.lock_outline),
                suffixIcon: const Icon(Icons.visibility),
                border: OutlineInputBorder(
                  borderRadius: BorderRadius.circular(12),
                ),
              ),
              const SizedBox(height: 40),
              ElevatedButton(
                onPressed: () {
                  // Do something
                },
                style: ElevatedButton.styleFrom(
                    minimumSize: const Size(
                  double.infinity,
                  60,
                )),
                child: const Text('Sign Up'),
              )
            ],
          ),
        ),
      ),
    );
  }
}


Properties #

The following properties are available for customization:

controller: A TextEditingController for controlling the text field's text value.
validator: A function for validating the text input.
border, focusedBorder, enabledBorder, errorBorder, disabledBorder: Input border decorations for the text field.
suffixIcon, prefixIcon: Icon widgets to be displayed at the end or beginning of the text field.
contentPadding: Padding for the text field's content.
inputLabelStyle, inputHintStyle, inputTextStyle: Styles for the text field's label, hint, and text.
inputKeyboardType: The keyboard type for the text field.
autocorrect: Whether autocorrection should be enabled.
obscureText: Whether the text field should obscure the entered text.
inputSuggestions: Whether input suggestions should be enabled.
inputAction: The type of action button to display on the keyboard.
inputFilled: Whether the input field should be filled with color.
inputFillColor: The fill color for the input field.
inputLabel: The label for the input field.
inputHint: The hint for the input field.
onChanged: A function called when the text input changes.
minLines: The minimum number of lines to occupy when the content spans fewer lines..
maxLines: TThe maximum number of lines to show at one time, wrapping if necessary.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

Additional information #

For more information about this package, including how to contribute, file issues, or contact the package authors, see the package repository on GitHub: my_formfield.

1
likes
0
points
37
downloads

Publisher

unverified uploader

Weekly Downloads

A customizable widget for easier and better implementation of the textformfield.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on my_formfield