TextField class

A themed text field with full form integration (validator + saved value).

Wraps TextField inside a FormField so it validates like a normal TextFormField.

Inheritance
Available extensions

Constructors

TextField({Key? key, TextEditingController? controller, String? label, String? hint, IconData? icon, String? prefixText, Widget? suffixIcon, String? errorText, TextInputType? keyboardType, TextInputAction? textInputAction, bool obscureText = false, String obscuringCharacter = '•', bool enabled = true, bool readOnly = false, int maxLines = 1, int? minLines, int? maxLength, String? validator(String?)?, ValueChanged<String>? onChanged, ValueChanged<String>? onSubmitted, VoidCallback? onTap, FocusNode? focusNode, String? initialValue, bool autofocus = false, Iterable<String>? autofillHints, List<TextInputFormatter>? inputFormatters, TextCapitalization capitalization = TextCapitalization.none, AutovalidateMode? autovalidateMode, bool filled = true, Color? focusBorderColor, double borderRadius = AppRadius.medium, ValueChanged<String?>? onFieldSaved, TextAlign textAlign = TextAlign.start, Color? cursorColor, TextStyle? textStyle, InputDecoration? decoration})
const

Properties

autofillHints → Iterable<String>?
Autofill hints.
final
autofocus → bool
Whether to focus on mount.
final
autovalidateMode → AutovalidateMode?
Autovalidate mode.
final
borderRadius → double
Corner radius.
final
capitalization → TextCapitalization
Text capitalization.
final
centered → Widget

Available on Widget, provided by the WidgetX extension

Wraps the widget in a Center.
no setter
controller → TextEditingController?
Optional external controller.
final
cursorColor → Color?
Cursor color.
final
decoration → InputDecoration?
Explicit InputDecoration override (for Flutter compatibility).
final
enabled → bool
Whether editing is allowed.
final
errorText → String?
Static error text.
final
filled → bool
Background fill.
final
focusBorderColor → Color?
Focused border color.
final
focusNode → FocusNode?
External focus node.
final
hashCode → int
The hash code for this object.
no setterinherited
hint → String?
Hint text.
final
icon → IconData?
Leading icon.
final
initialValue → String?
Initial value.
final
inputFormatters → List<TextInputFormatter>?
Input formatters.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardType → TextInputType?
Keyboard type.
final
label → String?
Label text.
final
maxLength → int?
Maximum input length.
final
maxLines → int
Maximum lines.
final
minLines → int?
Minimum lines.
final
obscureText → bool
Mask the input.
final
obscuringCharacter → String
Character used for masking.
final
onChanged → ValueChanged<String>?
Called when the value changes.
final
onFieldSaved → ValueChanged<String?>?
Called when the form saves the value.
final
onSubmitted → ValueChanged<String>?
Called on submit.
final
onTap → VoidCallback?
Called on tap.
final
prefixText → String?
Text shown before the input value.
final
readOnly → bool
Whether the field is read-only.
final
repaint → Widget

Available on Widget, provided by the WidgetX extension

Wraps in RepaintBoundary to isolate repaints.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
suffixIcon → Widget?
Trailing widget.
final
textAlign → TextAlign
Text alignment.
final
textInputAction → TextInputAction?
Keyboard action.
final
textStyle → TextStyle?
Input text style.
final
validator → String? Function(String?)?
Form validator.
final

Methods

animatedSwitcher({Duration duration = const Duration(milliseconds: 300), AnimatedSwitcherTransitionBuilder transitionBuilder = _defaultAnimatedSwitcherTransition, AnimatedSwitcherLayoutBuilder layoutBuilder = AnimatedSwitcher.defaultLayoutBuilder}) → Widget

Available on Widget, provided by the WidgetX extension

Wraps in an AnimatedSwitcher with duration and default fade.
build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
buildDecoration(BuildContext context, {String? error}) → InputDecoration
Builds the InputDecoration used by this field.
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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
expanded({int flex = 1}) → Widget

Available on Widget, provided by the WidgetX extension

Expands the widget inside a Flex parent.
fadeIn({double opacity = 1, Duration duration = const Duration(milliseconds: 300), Curve curve = Curves.easeIn}) → Widget

Available on Widget, provided by the WidgetAnimateX extension

Wraps in an AnimatedOpacity.
flexible({int flex = 1, FlexFit fit = FlexFit.loose}) → Widget

Available on Widget, provided by the WidgetX extension

Applies flexible sizing.
keyed(Object key) → Widget

Available on Widget, provided by the WidgetX extension

Wraps the widget in a KeyedSubtree with key.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onTap(VoidCallback onTap, {HitTestBehavior behavior = HitTestBehavior.opaque}) → Widget

Available on Widget, provided by the WidgetX extension

Wraps the widget in GestureDetector with onTap.
pad({double horizontal = 0, double vertical = 0}) → Widget

Available on Widget, provided by the WidgetX extension

Applies symmetric padding.
padded([double padding = AppSpacing.lg]) → Widget

Available on Widget, provided by the WidgetX extension

Applies uniform padding.
scaleOnTap({double scale = 0.95, required VoidCallback onTap, Duration duration = const Duration(milliseconds: 150)}) → Widget

Available on Widget, provided by the WidgetAnimateX extension

Wraps in an AnimatedScale.
semantics({required String label, bool button = false}) → Widget

Available on Widget, provided by the WidgetX extension

Wraps in a Semantics node with label.
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
visible({bool condition = true}) → Widget

Available on Widget, provided by the WidgetX extension

Hides the widget entirely when condition is false.
withPadding(EdgeInsetsGeometry padding) → Widget

Available on Widget, provided by the WidgetX extension

Applies padding only.

Operators

operator ==(Object other) → bool
The equality operator.
inherited