PremiumTextField class

A premium text field with modern styling and animations.

Features:

  • Multiple style variants (filled, outlined, underline, glass, neumorphic)
  • Animated focus states
  • Leading and trailing icons
  • Error and helper text
  • Character counter
  • Password visibility toggle
  • Full customization

Example usage:

PremiumTextField(
  label: 'Email',
  hint: 'Enter your email',
  variant: PremiumTextFieldVariant.outlined,
  leadingIcon: Icons.email,
  validator: (value) => value?.contains('@') == true ? null : 'Invalid email',
)
Inheritance

Constructors

PremiumTextField.new({Key? key, TextEditingController? controller, FocusNode? focusNode, String? label, String? hint, String? helperText, String? errorText, String? prefixText, String? suffixText, IconData? leadingIcon, IconData? trailingIcon, Widget? leading, Widget? trailing, PremiumTextFieldVariant variant = PremiumTextFieldVariant.filled, bool isPassword = false, bool readOnly = false, bool enabled = true, bool autofocus = false, int? maxLines = 1, int? minLines, int? maxLength, TextInputType? keyboardType, TextInputAction? textInputAction, TextCapitalization textCapitalization = TextCapitalization.none, List<TextInputFormatter>? inputFormatters, String? validator(String?)?, ValueChanged<String>? onChanged, ValueChanged<String>? onSubmitted, VoidCallback? onEditingComplete, VoidCallback? onTap, VoidCallback? onTrailingTap, Color? primaryColor, Color? errorColor, Color? backgroundColor, double? borderRadius, EdgeInsetsGeometry? contentPadding, bool isDarkMode = true, bool showCounter = false, ModernStyleOptions? styleOptions})
const

Properties

autofocus bool
Whether to autofocus.
final
backgroundColor Color?
Background color.
final
borderRadius double?
Border radius.
final
contentPadding EdgeInsetsGeometry?
Content padding.
final
controller TextEditingController?
Text controller.
final
enabled bool
Whether the field is enabled.
final
errorColor Color?
Error color.
final
errorText String?
Error text (overrides helperText when set).
final
focusNode FocusNode?
Focus node.
final
hashCode int
The hash code for this object.
no setterinherited
helperText String?
Helper text.
final
hint String?
Hint text.
final
inputFormatters List<TextInputFormatter>?
Input formatters.
final
isDarkMode bool
Whether to use dark mode styling.
final
isPassword bool
Whether the field is for password input.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardType TextInputType?
Keyboard type.
final
label String?
Label text.
final
leading Widget?
Custom leading widget.
final
leadingIcon IconData?
Leading icon.
final
maxLength int?
Maximum length.
final
maxLines int?
Maximum lines.
final
minLines int?
Minimum lines.
final
onChanged ValueChanged<String>?
On changed callback.
final
onEditingComplete VoidCallback?
On editing complete callback.
final
onSubmitted ValueChanged<String>?
On submitted callback.
final
onTap VoidCallback?
On tap callback.
final
onTrailingTap VoidCallback?
On trailing icon tap.
final
prefixText String?
Prefix text.
final
primaryColor Color?
Primary color.
final
readOnly bool
Whether the field is read-only.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showCounter bool
Whether to show the character counter.
final
styleOptions ModernStyleOptions?
Custom style options.
final
suffixText String?
Suffix text.
final
textCapitalization TextCapitalization
Text capitalization.
final
textInputAction TextInputAction?
Text input action.
final
trailing Widget?
Custom trailing widget.
final
trailingIcon IconData?
Trailing icon.
final
validator String? Function(String?)?
Validator function.
final
variant PremiumTextFieldVariant
Style variant.
final

Methods

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