XTextField class
A flexible text field widget supporting:
- Standard text input
- File picker
- Dropdown list
- Date picker
- Time picker
Includes:
- Customizable style
- Validation
- Character counter
- Common callbacks
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- XTextField
Constructors
- XTextField({Key? key, TextEditingController? controller, TextStyle? textStyle, TextStyle? labelStyle, TextStyle? hintStyle, String? label, String? labelOnLine, String? hintText, bool isRequired = false, bool isEnable = true, Widget? prefixIcon, Widget? suffixIcon, TextInputType inputType = TextInputType.text, XTextFieldType fieldType = XTextFieldType.normal, TextCapitalization textCapitalization = TextCapitalization.sentences, int minLines = 1, int maxLines = 1, int maxLength = 500, bool isShowCounter = false, void onChanged(String)?, VoidCallback? onTap, TextInputAction textInputAction = TextInputAction.next, XTextFieldStyle? style, XTextFieldFileOptions? fileOptions, XTextFieldDropdownOptions? dropdownOptions, XTextFieldDatePickerOptions? datePickerOptions, XTextFieldTimePickerOptions? timePickerOptions, String? validator(String?)?, void onFileSelected(File?)?, void onDropdownChanged(dynamic)?, void onDateSelected(DateTime?)?, void onTimeSelected(TimeOfDay?)?, bool isReadOnly = false, bool isObscureText = false, TextAlign textAlign = TextAlign.start, EdgeInsets? contentPadding, AutovalidateMode? autovalidateMode, String? asyncErrorText, void onSaved(String?)?, FloatingLabelBehavior floatingLabelBehavior = .auto})
-
Creates a new customizable XTextField.
const
Properties
- asyncErrorText → String?
-
For async/server-side validation errors (e.g., "email already exists")
This is separate from the synchronous validator and will be displayed
alongside validator errors. Clear this when user changes the field.
final
- autovalidateMode → AutovalidateMode?
-
Controls when validation occurs. See AutovalidateMode for details.
final
- contentPadding → EdgeInsets?
-
final
- controller → TextEditingController?
-
final
- datePickerOptions → XTextFieldDatePickerOptions?
-
final
- dropdownOptions → XTextFieldDropdownOptions?
-
final
- fieldType → XTextFieldType
-
final
- fileOptions → XTextFieldFileOptions?
-
final
- floatingLabelBehavior → FloatingLabelBehavior
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hintStyle → TextStyle?
-
final
- hintText → String?
-
final
- inputType → TextInputType
-
final
- isEnable → bool
-
final
- isObscureText → bool
-
final
- isReadOnly → bool
-
final
- isRequired → bool
-
final
- isShowCounter → bool
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String?
-
final
- labelOnLine → String?
-
final
- labelStyle → TextStyle?
-
final
- maxLength → int
-
final
- maxLines → int
-
final
- minLines → int
-
final
- onChanged → void Function(String)?
-
final
- onDateSelected → void Function(DateTime?)?
-
final
- onDropdownChanged → void Function(dynamic)?
-
final
- onFileSelected → void Function(File?)?
-
final
- onSaved → void Function(String?)?
-
Optional callback that's called when formKey.currentState!.save() is invoked.
This is a standard Flutter Form API feature for collecting form data.
If you prefer using controllers, you can ignore this.
final
- onTap → VoidCallback?
-
final
- onTimeSelected → void Function(TimeOfDay?)?
-
final
- prefixIcon → Widget?
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- style → XTextFieldStyle?
-
final
- suffixIcon → Widget?
-
final
- textAlign → TextAlign
-
final
- textCapitalization → TextCapitalization
-
final
- textInputAction → TextInputAction
-
final
- textStyle → TextStyle?
-
final
- timePickerOptions → XTextFieldTimePickerOptions?
-
final
- validator → String? Function(String?)?
-
Field validator - accepts standard Flutter validator function
Use XFormValidator for common validations:
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< XTextField> -
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