MyTextField constructor
const
MyTextField({
- Key? key,
- TextEditingController? controller,
- String? label,
- String? hint,
- IconData? iconData,
- Widget? prefixIcon,
- Widget? suffixIcon,
- Widget? suffixWidget,
- VoidCallback? onClick,
- ValueChanged<
String> ? onSubmitted, - bool border = true,
- bool enabled = true,
- bool readOnly = false,
- bool obscureText = false,
- bool autofocus = false,
- int? minLines,
- int? maxLines = 1,
- TextInputType? keyboardType,
- TextInputAction? textInputAction,
- TextCapitalization textCapitalization = TextCapitalization.sentences,
- InputDecoration? inputDecoration,
- TextStyle? hintStyle,
Creates a customized text field.
Implementation
const MyTextField({
super.key,
this.controller,
this.label,
this.hint,
this.iconData,
this.prefixIcon,
this.suffixIcon,
this.suffixWidget,
this.onClick,
this.onSubmitted,
this.border = true, // Default to having an outline border
this.enabled = true, // Default to enabled
this.readOnly = false,
this.obscureText = false,
this.autofocus = false,
this.minLines,
this.maxLines = 1, // Default to single line like TextField
this.keyboardType,
this.textInputAction,
this.textCapitalization = TextCapitalization.sentences, // Sensible default
this.inputDecoration, // Allow providing a full custom decoration
this.hintStyle, // Allow overriding hint style
}) : assert(prefixIcon == null || iconData == null,
'Cannot provide both prefixIcon and iconData'),
assert(suffixIcon == null || suffixWidget == null,
'Cannot provide both suffixIcon and suffixWidget');