NumericInput class

A comprehensive numeric input field for the Alter Design System built on InputControl.

Features:

  • Smart comma formatting (International 1,000,000 & Indian 10,00,000 systems).
  • Bounds enforcement (minValue, maxValue), decimal places, and negative numbers.
  • Optional stepper controls (+ / -) using ButtonIconGhost.
  • Reuses InputControl for full token fidelity and error displays.
Inheritance

Constructors

NumericInput({Key? key, String? label = 'Number', bool isRequired = false, int? characterLimit, InputControlType type = InputControlType.gray, NumberGroupingSystem groupingSystem = NumberGroupingSystem.international, bool allowDecimals = true, int? decimalPlaces, bool allowNegative = false, num? minValue, num? maxValue, IconData? leftIcon, Widget? leftIconWidget, String? prefix, Widget? prefixWidget, String placeholder = '0', num? initialValue, TextEditingController? controller, FocusNode? focusNode, String? suffix, Widget? suffixWidget, ButtonIconGhost? rightButton, 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<num?>? onNumberChanged, ValueChanged<String>? onChanged, ValueChanged<String>? onSubmitted, VoidCallback? onTap})
Creates a NumericInput instance.
const

Properties

allowDecimals → bool
Whether decimal numbers are allowed.
final
allowNegative → bool
Whether negative numbers are allowed.
final
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
decimalPlaces → int?
Maximum allowed decimal fraction digits.
final
enabled → bool
Whether the numeric 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
groupingSystem → NumberGroupingSystem
Grouping format (none, international, or indian).
final
hashCode → int
The hash code for this object.
no setterinherited
initialValue → num?
Initial numeric value.
final
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?
Label text displayed above the numeric field.
final
leftIcon → IconData?
Leading icon data.
final
leftIconWidget → Widget?
Custom leading widget override.
final
maxValue → num?
Maximum numeric value bound.
final
minValue → num?
Minimum numeric value bound.
final
onChanged → ValueChanged<String>?
Callback returning raw text string on change.
final
onNumberChanged → ValueChanged<num?>?
Callback returning parsed numeric value on change.
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.
final
prefix → String?
Prefix text string.
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 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

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<NumericInput>
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: Removed stepper controls in favor of standard rightButton (ButtonIconGhost) slot matching InputControl Figma spec. v2.2.0: Added deferred isRequired validation on blur/touch, preventing premature errors on initial focus. v2.1.0: Aligned with InputControl v2.1.0 (removed showLabel/showCharacterLimit; labelBar renders when label is provided). v2.0.0: Aligned with InputControl v2.0.0 (removed statusOverride and redundant hasX booleans in favor of clean nullable props). v1.0.0: Initial release of NumericInput built directly on InputControl with live comma formatting.