NumberInputModel class

Interactive numeric input component.

  • Arrow-Up / Ctrl+P → increment by step (clamped to max)
  • Arrow-Down / Ctrl+N → decrement by step (clamped to min)
  • Digit keys → typed directly (non-digit characters ignored)
  • Backspace → delete last character
  • Enter → validate and submit
  • Escape / Ctrl+C → cancel

The component emits NumberSubmittedMsg on success or NumberCancelledMsg on cancel.

Example:

final model = NumberInputModel(
  prompt: 'Port number:',
  defaultValue: 8080,
  min: 1,
  max: 65535,
  step: 1,
);
Inheritance

Constructors

NumberInputModel({String prompt = '? ', String placeholder = '', num? defaultValue, num? min, num? max, num step = 1, String hint = '', bool showHelp = true, NumberInputKeyMap? keyMap, NumberInputStyles? styles, String? validate(num)?})
Creates a new number-input model.

Properties

error String?
The current validation error, or null.
no setter
hashCode int
The hash code for this object.
no setterinherited
hint String
Hint text shown below the input.
final
keyMap NumberInputKeyMap
Key bindings.
final
max num?
Maximum allowed value (no upper bound if null).
final
min num?
Minimum allowed value (no lower bound if null).
final
numericValue num?
Parses and returns the current numeric value, or null if not a valid number.
no setter
placeholder String
Placeholder text when the input is empty.
final
prompt String
The label shown before the input field.
final
rawInput String
The raw string currently shown in the input field.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showHelp bool
Whether to show the keyboard shortcut help line.
final
step num
Amount to increment/decrement per key press.
final
styles NumberInputStyles
Visual styles.
final
validate String? Function(num)?
Optional extra validator: return an error string or null.
final

Methods

init() Cmd?
Returns an optional command to execute on program startup.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
update(Msg msg) → (NumberInputModel, Cmd?)
Updates the component state in response to a message.
override
view() String
Renders the current model state for display.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited