Stepper class
A numeric stepper: [ − 42 + ]. When focused, Up / Down (or + / −)
change the value by step, PageUp / PageDown by largeStep, and Home /
End jump to min / max. Typing digits enters a value directly; Enter or
leaving the field commits it, and Escape cancels. Clicking the − or +
half also nudges the value, so pointer users get the same affordance.
Controlled — hold the value yourself and update it from onChanged. Passing null for onChanged disables the stepper.
Stepper(
value: count,
min: 0,
max: 100,
onChanged: (v) => setState(() => count = v),
)
- Inheritance
-
- Object
- Widget
- StatefulWidget
- Stepper
- Available extensions
Constructors
Properties
- autofocus → bool
-
Whether the stepper should request focus when mounted.
final
- focusNode → FocusNode?
-
Focus node used for keyboard and text-input interaction.
final
- formatter → String Function(num value)?
-
Renders the value into the display string. Defaults to
v.toInt().toString()for whole values and a one-decimal form otherwise — mirrors what BarChart uses, so the look matches.final - hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
finalinherited
- label → String?
-
Optional label shown to the left of the stepper.
final
- largeStep → num
-
Amount added/subtracted on PageUp / PageDown. Should be ≥ step.
final
- max → num?
-
Upper bound.
nullmeans unbounded above.final - min → num?
-
Lower bound.
nullmeans unbounded below.final - onChanged → void Function(num value)?
-
Called with the new value when the user nudges it.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- step → num
-
Amount added/subtracted on Up / Down / + / − or a click on a button.
final
- style → CellStyle?
-
Base styling for the value and frame, plus optional hover, focus,
disabled, and invalid state entries from CellStyle.interactive.
final
- value → num
-
Current value.
final
Methods
-
animate(
{Duration? duration, Curve? curve, Object? trigger, bool repeat = false}) → Animate -
Available on Widget, provided by the AnimateExtension extension
Starts an Animate chain over this widget.duration/curveapply to the whole chain. With notriggerit plays on mount; with a non-null trigger it rests on mount and replays whenever the token changes. -
createElement(
) → StatefulElement -
Creates the Element that will mount this widget into the tree.
inherited
-
createState(
) → State< Stepper> -
Creates the mutable state for this widget at the current location in
the tree. Called exactly once per StatefulElement instance.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited