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
Available extensions

Constructors

Stepper({Key? key, required num value, required void onChanged(num value)?, num? min, num? max, num step = 1, num largeStep = 10, String formatter(num value)?, String? label, FocusNode? focusNode, bool autofocus = false, CellStyle? style})
const

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. null means unbounded above.
final
min → num?
Lower bound. null means 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 / curve apply to the whole chain. With no trigger it 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