FormCraftTextField class

A FormCraftTextField widget that can be used to build a FormCraft form.

onChanged is a required callback that is called whenever the input value changes. validators is an optional list of FormCraftValidator functions that are called whenever the input value changes. initialValue is an optional string that is used to set the initial value of the input. globalKey is a required key that is used to manage the state of the FormCraftTextField widget. decorationBuilder is an optional callback that provides custom decoration based on the validation error message.

This widget is a wrapper around the TextField widget and provides additional functionality. It can be used to build a FormCraft form by passing it to the FormCraft.buildTextField method.

Inheritance

Constructors

FormCraftTextField({required Key globalKey, required dynamic onChanged(String value), List<FormCraftValidator>? validators, String? initialValue, UndoHistoryController? undoController, TextInputType? keyboardType, TextInputAction? textInputAction, TextCapitalization textCapitalization = TextCapitalization.none, TextStyle? style, StrutStyle? strutStyle, TextAlign textAlign = TextAlign.start, TextAlignVertical? textAlignVertical, TextDirection? textDirection, bool readOnly = false, Widget contextMenuBuilder(BuildContext, EditableTextState)?, bool? showCursor, String obscuringCharacter = '•', bool autofocus = false, bool obscureText = false, bool autocorrect = true, SmartDashesType? smartDashesType, SmartQuotesType? smartQuotesType, int? minLines, int? maxLength, MaxLengthEnforcement? maxLengthEnforcement, void onEditingComplete()?, void onSubmitted(String)?, void onAppPrivateCommand(String, Map<String, dynamic>)?, List<TextInputFormatter>? inputFormatters, bool? enabled, double? cursorHeight, Radius? cursorRadius, bool? cursorOpacityAnimates, Color? cursorColor, Brightness? keyboardAppearance, bool? enableInteractiveSelection, TextSelectionControls? selectionControls, void onTap()?, void onTapOutside(PointerDownEvent)?, MouseCursor? mouseCursor, Widget? buildCounter(BuildContext, {required int currentLength, required bool isFocused, required int? maxLength})?, ScrollController? scrollController, ScrollPhysics? scrollPhysics, ContentInsertionConfiguration? contentInsertionConfiguration, String? restorationId, SpellCheckConfiguration? spellCheckConfiguration, TextMagnifierConfiguration? magnifierConfiguration, InputDecoration decorationBuilder(String? errorMessage)?, bool enableSuggestions = true, int? maxLines = 1, double cursorWidth = 2.0, EdgeInsets scrollPadding = const EdgeInsets.all(20.0), BoxHeightStyle selectionHeightStyle = ui.BoxHeightStyle.tight, BoxWidthStyle selectionWidthStyle = ui.BoxWidthStyle.tight, bool expands = false, DragStartBehavior dragStartBehavior = DragStartBehavior.start, Iterable<String>? autofillHints = const <String>[], Clip clipBehavior = Clip.hardEdge, bool scribbleEnabled = true, bool enableIMEPersonalizedLearning = true, bool canRequestFocus = true, String? customErrorMessage})
const

Properties

autocorrect bool
final
autofillHints Iterable<String>?
final
autofocus bool
final
buildCounter Widget? Function(BuildContext, {required int currentLength, required bool isFocused, required int? maxLength})?
final
canRequestFocus bool
final
clipBehavior Clip
final
contentInsertionConfiguration ContentInsertionConfiguration?
final
contextMenuBuilder Widget Function(BuildContext, EditableTextState)?
final
cursorColor Color?
final
cursorHeight double?
final
cursorOpacityAnimates bool?
final
cursorRadius Radius?
final
cursorWidth double
final
customErrorMessage String?
An optional string that is used to set error message for the input.
final
decorationBuilder InputDecoration Function(String? errorMessage)?
An optional callback that provides custom decoration based on the validation error message.
final
dragStartBehavior DragStartBehavior
final
enabled bool?
final
enableIMEPersonalizedLearning bool
final
enableInteractiveSelection bool?
final
enableSuggestions bool
final
expands bool
final
globalKey Key
A required key that is used to manage the state of the FormCraftTextField widget.
final
hashCode int
The hash code for this object.
no setterinherited
initialValue String?
An optional string that is used to set the initial value of the input.
final
inputFormatters List<TextInputFormatter>?
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardAppearance Brightness?
final
keyboardType TextInputType?
final
magnifierConfiguration TextMagnifierConfiguration?
final
maxLength int?
final
maxLengthEnforcement MaxLengthEnforcement?
final
maxLines int?
final
minLines int?
final
mouseCursor MouseCursor?
final
obscureText bool
final
obscuringCharacter String
final
onAppPrivateCommand → void Function(String, Map<String, dynamic>)?
final
onChanged → dynamic Function(String value)
Required callback that is called whenever the input value changes.
final
onEditingComplete → void Function()?
final
onSubmitted → void Function(String)?
final
onTap → void Function()?
final
onTapOutside → void Function(PointerDownEvent)?
final
readOnly bool
final
restorationId String?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scribbleEnabled bool
final
scrollController ScrollController?
final
scrollPadding EdgeInsets
final
scrollPhysics ScrollPhysics?
final
selectionControls TextSelectionControls?
final
selectionHeightStyle BoxHeightStyle
final
selectionWidthStyle BoxWidthStyle
final
showCursor bool?
final
smartDashesType SmartDashesType?
final
smartQuotesType SmartQuotesType?
final
spellCheckConfiguration SpellCheckConfiguration?
final
strutStyle StrutStyle?
final
style TextStyle?
final
textAlign TextAlign
final
textAlignVertical TextAlignVertical?
final
textCapitalization TextCapitalization
final
textDirection TextDirection?
final
textInputAction TextInputAction?
final
undoController UndoHistoryController?
final
validators List<FormCraftValidator>?
An optional list of FormCraftValidator functions that are called
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<FormCraftTextField>
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