M3ETextField constructor
const
M3ETextField({
- TextEditingController? controller,
- FocusNode? focusNode,
- String? label,
- String? supportingText,
- String? errorText,
- Widget? leading,
- Widget? trailing,
- M3ETextFieldVariant variant = M3ETextFieldVariant.filled,
- bool obscureText = false,
- bool enabled = true,
- TextInputType? keyboardType,
- TextInputAction? textInputAction,
- List<
TextInputFormatter> ? inputFormatters, - ValueChanged<
String> ? onChanged, - ValueChanged<
String> ? onSubmitted, - TapRegionCallback? onTapOutside,
- int? maxLines = 1,
- int? minLines,
- bool readOnly = false,
- bool autofocus = false,
- bool isRequired = false,
- String? prefixText,
- String? suffixText,
- String? prefixSemanticsLabel,
- String? suffixSemanticsLabel,
- String? placeholder,
- int? maxLength,
- bool? showCounter,
- M3ETextFieldCounterLabelBuilder counterSemanticsLabelBuilder = m3eTextFieldCounterLabel,
- bool supportingTextOnFocusOnly = false,
- bool showErrorIcon = true,
- bool showClearButton = false,
- bool showPasswordToggle = false,
- String clearButtonSemanticsLabel = 'Clear',
- String showPasswordSemanticsLabel = 'Show password',
- String hidePasswordSemanticsLabel = 'Hide password',
- String errorIconSemanticsLabel = 'Error',
- MouseCursor? mouseCursor,
- EditableTextContextMenuBuilder? contextMenuBuilder = m3eDefaultTextFieldContextMenuBuilder,
- TextCapitalization textCapitalization = TextCapitalization.none,
- TextAlign textAlign = TextAlign.start,
- int? density,
- M3ETextFieldSlotAlignment? iconAlignment,
- M3ETextFieldSlotAlignment? affixAlignment,
- M3ETextFieldTheme? theme,
- VoidCallback? onTap,
- VoidCallback? onEditingComplete,
- Key? key,
M3ETextField.
Implementation
const M3ETextField({
this.controller,
this.focusNode,
this.label,
this.supportingText,
this.errorText,
this.leading,
this.trailing,
this.variant = M3ETextFieldVariant.filled,
this.obscureText = false,
this.enabled = true,
this.keyboardType,
this.textInputAction,
this.inputFormatters,
this.onChanged,
this.onSubmitted,
this.onTapOutside,
this.maxLines = 1,
this.minLines,
this.readOnly = false,
this.autofocus = false,
this.isRequired = false,
this.prefixText,
this.suffixText,
this.prefixSemanticsLabel,
this.suffixSemanticsLabel,
this.placeholder,
this.maxLength,
this.showCounter,
this.counterSemanticsLabelBuilder = m3eTextFieldCounterLabel,
this.supportingTextOnFocusOnly = false,
this.showErrorIcon = true,
this.showClearButton = false,
this.showPasswordToggle = false,
this.clearButtonSemanticsLabel = 'Clear',
this.showPasswordSemanticsLabel = 'Show password',
this.hidePasswordSemanticsLabel = 'Hide password',
this.errorIconSemanticsLabel = 'Error',
this.mouseCursor,
this.contextMenuBuilder = m3eDefaultTextFieldContextMenuBuilder,
this.textCapitalization = TextCapitalization.none,
this.textAlign = TextAlign.start,
this.density,
this.iconAlignment,
this.affixAlignment,
this.theme,
this.onTap,
this.onEditingComplete,
super.key,
}) : assert(
!obscureText || maxLines == 1,
'Obscured text fields cannot be multi-line.',
),
assert(
!showPasswordToggle || maxLines == 1,
'The password toggle needs a single-line field.',
);