LayrzTextInput class

A Material-free text input field in the layrz_ui design system.

LayrzTextInput is a single-line text input with optional label, prefix/suffix slots, error display, help affordance, and keyboard shortcut badging. It wraps EditableText to provide a themed, ready-to-use input control.

Slot exclusivity: At most one of prefixIcon / prefix / prefixText may be non-null; the same rule applies to the suffix trio. Providing multiple slot values triggers an assertion error in debug mode.

Disposal contract: When controller or focusNode is null, the widget creates and disposes its own instances. Caller-supplied instances are never disposed.

Interaction states:

  • Disabled: Not editable, not tappable. Callbacks do not fire.
  • Read-only: Not editable but tap callbacks fire (used by picker-style inputs).
  • Error: Renders danger-colored border and error icon, displays error messages below.
  • Read-only lock icon: Appears only in read-only state, never in disabled state.
Inheritance

Constructors

LayrzTextInput({Key? key, String? labelText, String? hintText, bool isRequired = false, IconData? prefixIcon, Widget? prefix, String? prefixText, VoidCallback? onPrefixTap, IconData? suffixIcon, Widget? suffix, String? suffixText, VoidCallback? onSuffixTap, String? helpTitleText, String? helpContentText, bool disabled = false, bool readOnly = false, List<String> errors = const [], bool hideDetails = false, ValueChanged<String>? onChanged, ValueChanged<String>? onSubmit, ValueChanged<bool>? onFocusChanged, VoidCallback? onTap, TextEditingController? controller, FocusNode? focusNode, bool dense = false, TextInputType keyboardType = TextInputType.text, TextInputAction? textInputAction, List<TextInputFormatter> inputFormatters = const [], int? maxLength, bool autofocus = false, TextCapitalization textCapitalization = TextCapitalization.none, List<String> autofillHints = const [], bool obscureText = false, bool autocorrect = true, bool enableSuggestions = true, Set<LogicalKeyboardKey>? shortcut, Set<LayrzSelectableAction>? actions, TextAlign textAlign = TextAlign.start, String? helperText, BorderRadius? borderRadius, bool showBorder = true})
Creates a new LayrzTextInput with the given properties.
const

Properties

actions Set<LayrzSelectableAction>?
The set of text selection actions available in the context menu.
final
autocorrect bool
Whether autocorrection is enabled.
final
autofillHints List<String>
List of autofill hints for platform autofill services.
final
autofocus bool
Whether the field should request focus on creation.
final
borderRadius BorderRadius?
Optional border radius override for the input chrome.
final
controller TextEditingController?
The text editing controller for the input field.
final
dense bool
Whether the field uses the dense density variant.
final
disabled bool
Whether the field is disabled.
final
enableSuggestions bool
Whether suggestions are enabled.
final
errors List<String>
The list of error messages to display below the field.
final
focusNode FocusNode?
The focus node for the input field.
final
hashCode int
The hash code for this object.
no setterinherited
helpContentText String?
The content text for the help affordance tooltip.
final
helperText String?
Helper text displayed below the field.
final
helpTitleText String?
The title text for the help affordance tooltip.
final
hideDetails bool
Whether to hide the error message block and other detail text.
final
hintText String?
Hint text displayed as placeholder when the field is empty.
final
inputFormatters List<TextInputFormatter>
List of input formatters to apply to the input.
final
isRequired bool
Whether the field is marked as required.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
keyboardType TextInputType
The keyboard type for the input field.
final
labelText String?
The label text displayed above the input field.
final
maxLength int?
Maximum length of the input text.
final
obscureText bool
Whether the input text should be obscured (for passwords).
final
onChanged ValueChanged<String>?
Callback fired when the input value changes.
final
onFocusChanged ValueChanged<bool>?
Callback fired when the input gains or loses focus.
final
onPrefixTap VoidCallback?
Callback fired when the prefix is tapped.
final
onSubmit ValueChanged<String>?
Callback fired when the user submits the input (e.g., presses Enter).
final
onSuffixTap VoidCallback?
Callback fired when the suffix is tapped.
final
onTap VoidCallback?
Callback fired when the field is tapped.
final
prefix Widget?
Widget to render as a prefix.
final
prefixIcon IconData?
Icon to render as a prefix.
final
prefixText String?
Text to render as a prefix.
final
readOnly bool
Whether the field is read-only.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shortcut Set<LogicalKeyboardKey>?
The keyboard shortcut set to display as a muted badge.
final
showBorder bool
Whether to display the label above the chrome.
final
suffix Widget?
Widget to render as a suffix.
final
suffixIcon IconData?
Icon to render as a suffix.
final
suffixText String?
Text to render as a suffix.
final
textAlign TextAlign
The text alignment for the editable value.
final
textCapitalization TextCapitalization
The text capitalization behavior.
final
textInputAction TextInputAction?
The text input action (e.g., 'go', 'search', 'send').
final

Methods

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