SoftSaaSNumberInput class
Numeric input with drag-to-adjust, stepper buttons, and clamping.
Default style is flat and border-first (radius 7, no shadow) matching SoftSaaSTextInput. Set elevated to true for the neumorphic shadow treatment.
Features:
- Direct numeric text entry with validation
- Horizontal drag to adjust values
- Stepper up/down buttons
- Min/max bounds with clamping
- Decimal places control
- Optional suffix (e.g., '%', 'px')
- Optional label above field
Example:
SoftSaaSNumberInput(
value: 42,
min: 0,
max: 100,
step: 5,
suffix: '%',
onChanged: (v) => print(v),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SoftSaaSNumberInput
Constructors
-
SoftSaaSNumberInput({Key? key, double? value, ValueChanged<
double?> ? onChanged, ValueChanged<double?> ? onDragUpdate, VoidCallback? onDragEnd, bool readOnly = false, String? label, TextAlign labelAlignment = TextAlign.left, FocusNode? focusNode, bool showLabel = false, String? prefix, String? suffix, double? min, double? max, double step = 1.0, double dragSensitivity = 1.0, double? width, int? decimalPlaces, bool allowNegative = true, bool showStepper = true, SoftSaaSNumberInputSize size = SoftSaaSNumberInputSize.medium, bool enabled = true, bool elevated = false, List<double> ? presets, String presetLabel(double)?}) -
const
Properties
- allowNegative → bool
-
Whether negative values are allowed.
final
- decimalPlaces → int?
-
Number of decimal places to display.
null= auto (strip trailing zeros).final - dragSensitivity → double
-
Drag sensitivity multiplier (higher = more responsive).
final
- elevated → bool
-
Whether to use the neumorphic shadow style instead of the default
flat border-first look.
final
- enabled → bool
-
Whether the field is enabled.
final
- focusNode → FocusNode?
-
Optional external focus node.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String?
-
Label text displayed above the input.
final
- labelAlignment → TextAlign
-
Alignment of the label text.
final
- max → double?
-
Maximum allowed value.
final
- min → double?
-
Minimum allowed value.
final
-
onChanged
→ ValueChanged<
double?> ? -
Called with the committed value on submit, blur, stepper, or drag-end.
final
- onDragEnd → VoidCallback?
-
Called when a horizontal drag gesture ends.
final
-
onDragUpdate
→ ValueChanged<
double?> ? -
Called with the live value during horizontal drag.
final
- prefix → String?
-
Optional prefix label rendered inside the field on the leading edge
(e.g., 'W', 'H'). Unlike suffix, this is a visual label only — it
is never appended to the controller text or the committed value.
final
- presetLabel → String Function(double)?
-
Formatter for preset rows in the dropdown. Defaults to the numeric
value (with decimals respected) suffixed with suffix when set.
final
-
presets
→ List<
double> ? -
Optional preset values. When provided, the stepper is replaced with a
small triangle button that opens a dropdown of preset choices.
final
- readOnly → bool
-
Whether the field is read-only (no typing, dragging, or stepping).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showLabel → bool
-
Whether to show the label above the input.
final
- showStepper → bool
-
Whether to show up/down stepper buttons.
final
- size → SoftSaaSNumberInputSize
-
Size variant — matches SoftSaaSTextInputSize dimensions.
final
- step → double
-
Step size for drag and stepper increments.
final
- suffix → String?
-
Optional suffix appended to the display (e.g., '%', 'px').
final
- value → double?
-
Current numeric value.
nullmeans empty.final - width → double?
-
Fixed width. Defaults to 100 for the default style, unset for elevated.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< SoftSaaSNumberInput> -
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