my_formfield 0.0.4
my_formfield: ^0.0.4 copied to clipboard
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 #
Installation #
Add the following to your pubspec.yaml file:
dependencies:
my_formfield: ^0.0.4
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('My FormField'),
),
body: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
MyFormField(
inputLabel: 'Full name',
inputHint: 'Enter full name',
prefixIcon: const Icon(Icons.person_outline),
border:
OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
),
const SizedBox(height: 20),
MyFormField(
inputLabel: 'Email',
inputHint: 'Enter email address',
prefixIcon: const Icon(Icons.alternate_email),
border:
OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
),
const SizedBox(height: 20),
MyFormField(
inputLabel: 'Password',
inputHint: 'Enter password',
obscureText: true,
prefixIcon: const Icon(Icons.lock_outline),
suffixIcon: const Icon(Icons.visibility),
border:
OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
),
],
),
),
),
);
}
}
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.