InputControl class
A highly configurable, multi-slot input control primitive for the Alter Design System.
Direct 1:1 implementation of Figma Node 470:436 (InputControl):
labelBar: Top row containinglabelon left (isRequired) andcharacterLimiton right (rendered on UI when label is present)inputContainer: 64px box (padding: 20px 24px,borderRadius: 20px,gap: 16px)leftSection: Row containingleftIcon,prefix, and editableinput/ placeholdersuffix: Trailing unit or descriptor textrightButton: Trailing interactive action slot accepting ButtonIconGhost directlyerrorContainer: Bottom row with 16pxerror_outlineicon and caption text intextDanger(renders latest active error)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- InputControl
Constructors
-
InputControl({Key? key, String? label = 'Label', bool isRequired = false, int? characterLimit = 32, InputControlType type = InputControlType.gray, IconData? leftIcon = Icons.face_5_outlined, Widget? leftIconWidget, String? prefix = 'Prefix', Widget? prefixWidget, String placeholder = 'Input', String? value, TextEditingController? controller, FocusNode? focusNode, String? suffix = 'Suffix', Widget? suffixWidget, ButtonIconGhost? rightButton, bool obscureText = false, String obscuringCharacter = '•', int? maxLines = 1, int? minLines = 1, List<
TextInputFormatter> ? inputFormatters, bool isError = false, bool showErrorMessage = true, String errorMessage = 'Error Message', List<String> ? errorMessages, Widget? errorIconWidget, bool enabled = true, bool readOnly = false, ValueChanged<String> ? onChanged, ValueChanged<String> ? onSubmitted, VoidCallback? onTap, TextInputType? keyboardType, TextInputAction textInputAction = TextInputAction.done, bool autofocus = false}) -
Creates an InputControl instance.
const
Properties
- autofocus → bool
-
Whether the text field should autofocus on initial build.
final
- characterLimit → int?
-
Maximum allowed character limit counter displayed on typing.
final
- controller → TextEditingController?
-
External text editing controller.
final
- enabled → bool
-
Whether the input control is enabled for interaction.
final
- errorIconWidget → Widget?
-
Custom icon widget override for the error message row.
final
- errorMessage → String
-
Primary or default error message string.
final
-
errorMessages
→ List<
String> ? -
Optional list of multiple error messages (latest active rendered).
final
- focusNode → FocusNode?
-
Focus node controlling focus state.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
inputFormatters
→ List<
TextInputFormatter> ? -
Formatters applied to the text field input.
final
- isError → bool
-
Whether the field is in an 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
- keyboardType → TextInputType?
-
Virtual keyboard type for software keyboards.
final
- label → String?
-
Optional label text displayed above the input field.
final
- leftIcon → IconData?
-
Icon displayed on the leading side of the input.
final
- leftIconWidget → Widget?
-
Custom leading icon widget override.
final
- maxLines → int?
-
Maximum number of lines for multiline text input.
final
- minLines → int?
-
Minimum number of lines for multiline text input.
final
- obscureText → bool
-
Whether the text is masked (e.g. for password inputs).
final
- obscuringCharacter → String
-
Character used to mask obscured text (defaults to '•').
final
-
onChanged
→ ValueChanged<
String> ? -
Callback executed when the text content changes.
final
-
onSubmitted
→ ValueChanged<
String> ? -
Callback executed when text is submitted via keyboard.
final
- onTap → VoidCallback?
-
Callback executed when the input container is tapped.
final
- placeholder → String
-
Placeholder hint text displayed when input is empty.
final
- prefix → String?
-
Prefix text string displayed before the input text.
final
- prefixWidget → Widget?
-
Custom prefix widget override.
final
- readOnly → bool
-
Whether the field is read-only.
final
- rightButton → ButtonIconGhost?
-
Trailing action button (e.g. ButtonIconGhost).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showErrorMessage → bool
-
Whether the error message banner should be rendered beneath the field.
final
- suffix → String?
-
Suffix descriptor text displayed at the trailing end.
final
- suffixWidget → Widget?
-
Custom suffix widget override.
final
- textInputAction → TextInputAction
-
Action button type on the software keyboard (e.g. done, search).
final
- type → InputControlType
-
Visual background and border surface variant.
final
- value → String?
-
Initial or bound value string for the text field.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< InputControl> -
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.3.0: Streamlined multiline sizing: Clean minLines and maxLines configuration without redundant boolean flags; multiline cross-axis start alignment. v2.1.0: Streamlined label & character limit UI: Removed showLabel and showCharacterLimit booleans. labelBar is rendered whenever label is provided (with characterLimit counter shown on UI during typing). Character limit validation continues to function in background even without a label. v2.0.0: Pure Flutter convention overhaul: Removed InputControlStatus enum (visual states are 100% dynamically driven by FocusNode and TextEditingController). Streamlined API by removing redundant hasLabel, hasCharacterLimit, hasPrefix, hasSuffix, and hasLeftIcon in favor of clean nullable properties. v1.7.0: Removed redundant readonly and disabled from InputControlStatus; standardized on boolean enabled and readOnly properties. v1.6.0: Streamlined right action slot to accept ButtonIconGhost? rightButton directly (replacing split icon properties). v1.5.0: Replaced rightIcon slot with ButtonIconGhost component (with rightIconType and onRightIconTap); added obscureText, maxLines, minLines, and inputFormatters passthroughs. v1.4.0: Added isRequired support with asterisk matching label color. Added multiple error condition support rendering the latest error in order. v1.3.0: Added character limit overflow logic (isError=true, textDanger counter color, and 'Character limit exceeded' error message when character limit is crossed). v1.2.0: Hide entire labelBar if showLabel is false. Replaced wordLimit with numeric characterLimit showing "x/characterLimit" dynamically only in typing (selected) state. Replaced error status with independent isError and showErrorMessage properties. v1.1.0: Replaced initialValue with clean value property; streamlined placeholder and value auto-transitions. v1.0.0: Initial recreation of InputControl matching Figma Node 470:436.