MinimalSlider class
Continuous or stepped adjustment on a thin track: a 4 px hairline-weight track filled with the accent up to a 16 px ringed thumb, under a label line that prints the value in mono. Use a MinimalNumberField when the exact small integer matters.
Tap anywhere on the track or drag the thumb; under the keyboard the arrow
keys step it (a tenth of the range, or one division), Home and End jump
to the ends, and the thumb wears the 2 px focus ring. divisions snaps
the value and ticks the track (up to 20 ticks). format prints a value's
figure (20, 70%) and unit the word that follows it (pages): the
figure in mono, the word in Geist, and a screen reader hears both
(20 pages) for the current value AND for the one a step will reach.
With a unit and neither format nor valueLabel the figure is the
value rounded. A fixed
valueLabel can only name the current value, so prefer format; with
none of the three, the value prints nothing and announces as a
percentage. A null onChanged disables it. The touch strip is 44 tall
whatever the track paints.
style dresses one slider, components.slider every one, resolved with
WidgetState.pressed, WidgetState.focused and WidgetState.disabled:
fill (the track up to the thumb, and the thumb's ring), edge (the track
beyond it), foreground (the thumb's face), overlay (the halo while
held) and shape (the track's outline; a capsule unset). The thumb is a
disc whatever shapes says; t.focusWidth is its focus ring.
MinimalSlider(label: 'Daily reading goal', value: pages, min: 10, max: 50, divisions: 8, unit: 'pages', onChanged: setPages)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- MinimalSlider
Constructors
-
MinimalSlider({Key? key, required String label, required double value, ValueChanged<
double> ? onChanged, ValueChanged<double> ? onChangeEnd, double min = 0, double max = 1, int? divisions, String? valueLabel, String format(double value)?, String? unit, IconData? leadingIcon, IconData? trailingIcon, bool showLabel = true, MinimalStyle? style, FocusNode? focusNode, bool autofocus = false}) -
A slider setting
value.const
Properties
- autofocus → bool
-
Whether it takes keyboard focus when it first appears.
final
- divisions → int?
-
How many steps the track has; null for any value.
final
- focusNode → FocusNode?
-
Its focus node, for a caller that moves focus to it; null keeps one
of its own.
final
- format → String Function(double value)?
-
How any value's figure prints (
(v) => '${(v * 100).round()}%'), in mono on the line and in the same units to a screen reader, including the value an increase or decrease will reach. Figures and symbols only: a word goes in unit.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
-
What the slider sets: printed over the track unless showLabel is
false, and always announced.
final
- leadingIcon → IconData?
-
Glyphs at the track's ends (a quiet speaker, a loud one).
final
- max → double
-
The greatest value.
final
- min → double
-
The least value.
final
-
onChanged
→ ValueChanged<
double> ? -
Null disables the slider.
final
-
onChangeEnd
→ ValueChanged<
double> ? -
The value when a drag or a key press settles.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- showLabel → bool
-
Whether the label prints over the track.
final
- style → MinimalStyle?
-
This slider's style, over
components.slider.final - trailingIcon → IconData?
-
A glyph after the track.
final
- unit → String?
-
The word after the figure (
pages,min), printed in the body face and announced with every value.final - value → double
-
The value it shows.
final
- valueLabel → String?
-
The current value's figure (
10,70%), printed in mono, unit after it. Ignored when format is given.final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< MinimalSlider> -
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.
override
-
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