NumberConfigurable class
A configurable numeric field with optional slider mode.
When useSlider is true, opens a slider prompt bounded by
min and max. Otherwise opens a text input that parses
and validates the entered number.
NumberConfigurable(
key: 'port',
label: 'Port',
value: 8080,
min: 1,
max: 65535,
)
NumberConfigurable(
key: 'volume',
label: 'Volume',
value: 50,
min: 0,
max: 100,
useSlider: true,
unit: '%',
)
- Inheritance
-
- Object
- Configurable<
num> - NumberConfigurable
Constructors
- NumberConfigurable({required String key, required String label, required num value, String? validator(num value)?, String? description, String? hint, String formatter(num value)?, String? icon, num min = 0, num max = 100, num step = 1, String unit = '', int sliderWidth = 28, bool useSlider = false, bool showPercent = false, bool integerOnly = false})
- Creates a number configurable field.
Properties
- defaultTypeIcon → String
-
The default icon for this configurable type.
Override in subclasses to provide a type-specific glyph.
no setteroverride
- defaultValue → num
-
The original value before any edits.
finalinherited
- description → String?
-
Optional longer description shown as context when editing.
finalinherited
- displayValue → String
-
Formatted string representation of value for display in the list.
no setterinherited
- formatter → String Function(num value)?
-
Optional display formatter. When provided, displayValue uses this
instead of the default
toString()representation.finalinherited - hashCode → int
-
The hash code for this object.
no setterinherited
- hint → String?
-
Optional hint text shown alongside the field.
finalinherited
- icon → String?
-
Custom icon override. When set, typeIcon returns this instead of
the subclass default from defaultTypeIcon.
finalinherited
- integerOnly → bool
-
When
true, restricts the value to integers.final - isModified → bool
-
Whether the current value differs from defaultValue.
no setterinherited
- key → String
-
Unique key used for serialization and lookup.
finalinherited
- label → String
-
Human-readable label shown in the editor list.
finalinherited
- max → num
-
The maximum allowed value.
final
- min → num
-
The minimum allowed value.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showPercent → bool
-
When
true, shows a percentage label on the slider bar.final - sliderWidth → int
-
Width of the slider bar in characters.
final
- step → num
-
The increment step size for the slider.
final
- typeIcon → String
-
Glyph prefix identifying the field type in the list view.
Returns the custom icon if set, otherwise defaultTypeIcon.
no setterinherited
- unit → String
-
Unit label shown alongside the slider (e.g. '%', 'GB', 'ms').
final
- useSlider → bool
-
When
true, uses a slider prompt. Otherwise uses text input.final - validator → String? Function(num value)?
-
Optional validator. Returns an error message on failure,
nullon success. Returning''is also accepted as success for backwards compatibility.finalinherited - value ↔ num
-
The current value of this configurable.
getter/setter pairinherited
Methods
-
edit(
Terminice terminice) → bool -
Runs the appropriate terminice prompt to edit this field's value.
override
-
formatValue(
) → String -
Override in subclasses to provide type-specific formatting.
override
-
loadJsonValue(
dynamic jsonValue) → void -
Deserializes and applies a value from a JSON-compatible source.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
reset(
) → void -
Resets value back to defaultValue.
inherited
-
toJsonValue(
) → dynamic -
Serializes the current value into a JSON-compatible map entry.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
trySetValue(
num candidate) → bool -
Sets value to
candidateonly when it passes validation.inherited -
validate(
) → String? -
Validates the current value. Returns
nullif valid, error message otherwise.inherited -
validationErrorFor(
num candidate) → String? -
Validates a candidate value using the shared validator semantics.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited