SearchInput class

A specialized search input field component for the Alter Design System built on TextInput.

Features:

  • Pre-configured with a search left icon (Icons.search_rounded).
  • Dynamic clear button (ButtonIconGhost with Icons.close_rounded) displayed when text is present.
  • Search action keyboard type (TextInputAction.search).
  • Reuses TextInput for full form, label, character limit, and error support.
Inheritance

Constructors

SearchInput({Key? key, String? label, bool isRequired = false, int? characterLimit, InputControlType type = InputControlType.gray, IconData? leftIcon = Icons.search_rounded, Widget? leftIconWidget, String? prefix, Widget? prefixWidget, String placeholder = 'Search...', String? value, TextEditingController? controller, FocusNode? focusNode, String? suffix, Widget? suffixWidget, bool showClearButton = true, ButtonIconGhost? customRightButton, bool isError = false, bool showErrorMessage = true, String errorMessage = 'Error Message', List<String>? errorMessages, Widget? errorIconWidget, bool enabled = true, bool readOnly = false, bool autofocus = false, ValueChanged<String>? onChanged, ValueChanged<String>? onSubmitted, ValueChanged<String>? onSearch, VoidCallback? onClear, VoidCallback? onTap})
Creates a SearchInput instance.
const

Properties

autofocus → bool
Whether the input field autofocuses.
final
characterLimit → int?
Maximum allowed character limit counter displayed on typing.
final
controller → TextEditingController?
External text editing controller.
final
customRightButton → ButtonIconGhost?
Custom trailing action button override.
final
enabled → bool
Whether the search input is interactive.
final
errorIconWidget → Widget?
Custom icon widget override for the error message banner.
final
errorMessage → String
Default error message text.
final
errorMessages → List<String>?
Optional list of multiple error messages.
final
focusNode → FocusNode?
Focus node controlling input focus.
final
hashCode → int
The hash code for this object.
no setterinherited
isError → bool
Whether the input is in an explicit error state.
final
isRequired → bool
Whether to display a red required asterisk next to the label.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label → String?
Optional label text displayed above the search field.
final
leftIcon → IconData?
Leading icon data (defaults to Icons.search_rounded).
final
leftIconWidget → Widget?
Custom leading widget override.
final
onChanged → ValueChanged<String>?
Callback executed on value changes.
final
onClear → VoidCallback?
Callback executed when the clear button is pressed.
final
onSearch → ValueChanged<String>?
Callback executed when search is triggered.
final
onSubmitted → ValueChanged<String>?
Callback executed on keyboard submit.
final
onTap → VoidCallback?
Callback executed when the input container is tapped.
final
placeholder → String
Hint placeholder text (defaults to 'Search...').
final
prefix → String?
Prefix text displayed before the input value.
final
prefixWidget → Widget?
Custom prefix widget override.
final
readOnly → bool
Whether the field is read-only.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showClearButton → bool
Whether to display the clear 'X' button when text is entered.
final
showErrorMessage → bool
Whether to render the error message beneath the field.
final
suffix → String?
Suffix descriptor text displayed at the trailing end.
final
suffixWidget → Widget?
Custom suffix widget override.
final
type → InputControlType
Surface background and border style variant.
final
value → String?
Initial or bound value string.
final

Methods

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

Constants

version → const String
Component version for reference. v2.1.0: Aligned with InputControl v2.1.0 & TextInput v2.1.0 (removed showLabel/showCharacterLimit; labelBar renders when label is provided). v2.0.0: Aligned with InputControl v2.0.0 & TextInput v2.0.0 (removed statusOverride and redundant hasX booleans in favor of clean nullable props). v1.0.0: Initial release of SearchInput wrapper built on TextInput with dynamic clear button and search icon.