NIB / DOCUMENTATION
Slider and range — NibComponents
Scrub a value or adjust a bounded interval.
Open interactive viewChoose a domain and commit its value
The default domain is 0 to 1; min must be less than max. This demo uses 0 to 100. value is controlled and onChanged reports pointer or keyboard changes. onChangeStart and onChangeEnd delimit an interaction, so expensive persistence can wait for the end while the preview responds immediately.
Keep two thumbs ordered
NibSlider.range requires NibRangeValues(start, end). Thumbs clamp against each other and do not cross. NibRangeValues.clamp(min, max) sorts and bounds endpoints; copyWith creates a new pair. The demo writes both emitted endpoints into its configuration.
NibSlider.range(
values: NibRangeValues(low, high), min: 0, max: 100,
onChanged: (range) => setState(() { low = range.start; high = range.end; }),
)Choose continuous or stepped movement
divisions: null gives continuous values. A positive division count snaps to divisions + 1 ticks; ten divisions over 0–100 yields eleven stops. showValueLabel displays a bubble during dragging. valueLabelFormatter changes that bubble text without changing the numeric value.
Change the axis or thumb content
Axis.vertical puts the minimum at the bottom and needs a bounded height. The demo reserves 220 logical pixels. thumbBuilder receives NibSliderThumbState with value, dragging, focused, and size. It paints a replacement thumb; the slider still owns position and interaction. trackHeight defaults to 4 and thumbSize to 20.
Retain keyboard and semantic access
label names each thumb in semantics. A null change callback or disabled: true disables interaction. External focusNode applies to the first thumb and remains caller-owned. animated affects the press pop and value label; dragging and track fill still follow the pointer directly.
The range collapses or the slider has no space
Keep start no greater than end and keep both within the chosen domain. If a vertical slider has zero height, give its parent an explicit extent. If the thumb moves but the value resets, commit the emitted value in the parent. Animation is not a substitute for that state update.