AppTextField class

A highly customizable text form field with extensive configuration options.

Features:

  • Multiple style presets (outlined, filled, underline, rounded, pill)
  • Label positioning (above, inside, floating)
  • Prefix/suffix icons with customization
  • Error state with custom styling
  • Loading state indicator
  • Character counter
  • Password visibility toggle
  • Full accessibility support
  • Security validation

Example usage:

AppTextField(
  style: TextFieldStyle.outlined,
  label: 'Email',
  hint: 'Enter your email',
  prefixIconData: Icons.email,
  keyboardType: TextInputType.emailAddress,
  validator: (value) => value?.isEmpty ?? true ? 'Required' : null,
)
Inheritance

Constructors

AppTextField({Key? key, TextEditingController? controller, FocusNode? focusNode, void onChanged(String)?, void onSubmitted(String)?, VoidCallback? onTap, VoidCallback? onEditingComplete, void onSaved(String?)?, String? validator(String?)?, void onFocusChanged(bool)?, TextFieldStyle fieldStyle = TextFieldStyle.outlined, LabelPosition labelPosition = LabelPosition.above, String? label, String? hint, String? helperText, String? errorText, String? counterText, String? prefixText, String? suffixText, double? height, double? width, EdgeInsetsGeometry? contentPadding, double? borderRadius, double? borderWidth, double? labelSpacing, Color? backgroundColor, Color? focusedBackgroundColor, Color? disabledBackgroundColor, Color? borderColor, Color? focusedBorderColor, Color? errorBorderColor, Color? textColor, Color? hintColor, Color? labelColor, Color? errorColor, Color? cursorColor, Color? iconColor, Color? focusedIconColor, Color? prefixTextColor, Color? suffixTextColor, double? fontSize, FontWeight? fontWeight, String? fontFamily, double? labelFontSize, FontWeight? labelFontWeight, double? hintFontSize, TextStyle? textStyle, TextStyle? labelStyle, TextStyle? hintStyle, TextStyle? errorStyle, TextStyle? helperStyle, TextStyle? counterStyle, Widget? prefixIcon, Widget? suffixIcon, IconData? prefixIconData, IconData? suffixIconData, double? prefixIconSize, double? suffixIconSize, Color? prefixIconColor, Color? suffixIconColor, TextInputType? keyboardType, TextInputAction? textInputAction, TextCapitalization textCapitalization = TextCapitalization.none, bool autofocus = false, bool readOnly = false, bool enabled = true, bool enableSuggestions = true, bool autocorrect = true, bool? showCursor, bool obscureText = false, String obscuringCharacter = '•', bool showPasswordToggle = false, Widget? passwordVisibleIcon, Widget? passwordHiddenIcon, int? maxLength, int? maxLines = 1, int? minLines, bool expands = false, bool showCounter = false, List<TextInputFormatter>? inputFormatters, Iterable<String>? autofillHints, AutovalidateMode? autovalidateMode, bool isRequired = false, Color? requiredIndicatorColor, bool isLoading = false, Widget? loadingWidget, String? semanticsLabel, bool? enableSecurity})
const

Properties

autocorrect bool
final
autofillHints Iterable<String>?
final
autofocus bool
final
autovalidateMode AutovalidateMode?
final
backgroundColor Color?
final
borderColor Color?
final
borderRadius double?
final
borderWidth double?
final
contentPadding EdgeInsetsGeometry?
final
controller TextEditingController?
final
counterStyle TextStyle?
final
counterText String?
final
cursorColor Color?
final
disabledBackgroundColor Color?
final
enabled bool
final
enableSecurity bool?
final
enableSuggestions bool
final
errorBorderColor Color?
final
errorColor Color?
final
errorStyle TextStyle?
final
errorText String?
final
expands bool
final
fieldStyle TextFieldStyle
final
focusedBackgroundColor Color?
final
focusedBorderColor Color?
final
focusedIconColor Color?
final
focusNode FocusNode?
final
fontFamily String?
final
fontSize double?
final
fontWeight FontWeight?
final
hashCode int
The hash code for this object.
no setterinherited
height double?
final
helperStyle TextStyle?
final
helperText String?
final
hint String?
final
hintColor Color?
final
hintFontSize double?
final
hintStyle TextStyle?
final
iconColor Color?
final
inputFormatters List<TextInputFormatter>?
final
isLoading bool
final
isRequired bool
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardType TextInputType?
final
label String?
final
labelColor Color?
final
labelFontSize double?
final
labelFontWeight FontWeight?
final
labelPosition LabelPosition
final
labelSpacing double?
final
labelStyle TextStyle?
final
loadingWidget Widget?
final
maxLength int?
final
maxLines int?
final
minLines int?
final
obscureText bool
final
obscuringCharacter String
final
onChanged → void Function(String)?
final
onEditingComplete VoidCallback?
final
onFocusChanged → void Function(bool)?
final
onSaved → void Function(String?)?
final
onSubmitted → void Function(String)?
final
onTap VoidCallback?
final
passwordHiddenIcon Widget?
final
passwordVisibleIcon Widget?
final
prefixIcon Widget?
final
prefixIconColor Color?
final
prefixIconData IconData?
final
prefixIconSize double?
final
prefixText String?
final
prefixTextColor Color?
final
readOnly bool
final
requiredIndicatorColor Color?
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticsLabel String?
final
showCounter bool
final
showCursor bool?
final
showPasswordToggle bool
final
suffixIcon Widget?
final
suffixIconColor Color?
final
suffixIconData IconData?
final
suffixIconSize double?
final
suffixText String?
final
suffixTextColor Color?
final
textCapitalization TextCapitalization
final
textColor Color?
final
textInputAction TextInputAction?
final
textStyle TextStyle?
final
validator String? Function(String?)?
final
width double?
final

Methods

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