FlutterTextfield class
A customizable text field widget that wraps TextFormField with additional configuration options.
This widget supports a variety of features including text validation, prefix and suffix widgets, custom borders, and styling for labels and hints.
Example usage: dart FlutterCustomEdit( controller: _controller, // Can be null hintText: 'Enter text', validator: (value) => value!.isEmpty ? 'Field cannot be empty' : null, onChanged: (value) => print('Text changed: $value'), suffixWidget: Icon(Icons.visibility), prefixWidget: Icon(Icons.text_fields), textStyle: TextStyle(color: Colors.black), errorTextStyle: TextStyle(color: Colors.red), border: OutlineInputBorder(), labelText: 'Label', )
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- FlutterTextfield
Constructors
-
FlutterTextfield({Key? key, String? hintText, TextEditingController? controller, void onChanged(String val)?, TextInputType keyboardType = TextInputType.text, IconData errorIcon = Icons.error_sharp, Color errorColor = const Color(0xFFD8272D), double errorIconSize = 16, bool isObscure = false, bool autofocus = false, bool readOnly = false, FocusNode? focusNode, EdgeInsets? contentPadding, String? validator(String val)?, Widget? suffixWidget, int? maxLines, Widget? prefixWidget, bool? enabled, int? maxLength, TextInputAction? textInputAction, TextStyle? errorTextStyle, TextStyle? textStyle, void onTap()?, Color? cursorColor, InputBorder? border, TextStyle? hintTextStyle, List<
TextInputFormatter> ? inputFormatters, String? labelText, InputBorder? disabledBorder, InputBorder? errorBorder, InputBorder? enabledBorder, TextStyle? labelStyle}) -
Creates a
FlutterCustomEditwidget.const
Properties
- autofocus → bool
-
Whether the text field should autofocus when the widget is built.
final
- border → InputBorder?
-
The border to display around the text field.
final
- contentPadding → EdgeInsets?
-
Padding around the content of the text field.
final
- controller → TextEditingController?
-
An optional controller for managing the text being edited. If null, the text field will be unmanaged.
final
- cursorColor → Color?
-
The color of the cursor.
final
- disabledBorder → InputBorder?
-
The border to display when the text field is disabled.
final
- enabled → bool?
-
Whether the text field is enabled or disabled.
final
- enabledBorder → InputBorder?
-
The border to display when the text field is enabled.
final
- errorBorder → InputBorder?
-
The border to display when the text field has an error.
final
- errorColor → Color
-
The color of the error icon
final
- errorIcon → IconData
-
The icon to user for the error icon
final
- errorIconSize → double
-
The size of the error icon
final
- errorTextStyle → TextStyle?
-
Style to use for the error message text.
final
- focusNode → FocusNode?
-
A focus node to control the field's focus.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hintText → String?
-
An optional hint text displayed when the field is empty.
final
- hintTextStyle → TextStyle?
-
Style to use for the hint text.
final
-
inputFormatters
→ List<
TextInputFormatter> ? -
List of formatters to apply to the input.
final
- isObscure → bool
-
Whether the text should be obscured (e.g., for passwords).
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- keyboardType → TextInputType
-
The type of keyboard to use for input.
final
- labelStyle → TextStyle?
-
Style to use for the label text.
final
- labelText → String?
-
Optional text displayed above the text field as a label.
final
- maxLength → int?
-
The maximum length of text that can be entered.
final
- maxLines → int?
-
The maximum number of lines to show in the text field.
final
- onChanged → void Function(String val)?
-
A callback invoked when the text changes.
final
- onTap → void Function()?
-
Callback function invoked when the user taps on the text field.
final
- prefixWidget → Widget?
-
A widget displayed at the beginning of the text field.
final
- readOnly → bool
-
Whether the text field is read-only.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- suffixWidget → Widget?
-
A widget displayed at the end of the text field.
final
- textInputAction → TextInputAction?
-
Action to take when the user submits the text.
final
- textStyle → TextStyle?
-
Style to use for the text input.
final
- validator → String? Function(String val)?
-
A function to validate the input text.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< FlutterTextfield> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited