Dial class
A horizontal dial: tick marks slide under a fixed center indicator and the tick under it is the value.
Drag or fling to turn the dial; it always settles on a tick. Every majorEveryth tick is long and labelled, the middle one of each group is medium. The ends fade out with a ScrollShadow. Each tick passed gives a light haptic tap, and every change is reported live through onChanged. Tapping a tick moves to it, and the left and right arrow keys, Home and End step through the values once the dial is focused.
Dial(
value: temperature,
min: 10,
max: 30,
labelBuilder: (v) => '${v.round()}°',
onChanged: (v) => setState(() => temperature = v),
)
- Inheritance
Constructors
-
Dial({Key? key, double? value, DialController? controller, double min = 0.0, double max = 100.0, double step = 1.0, int majorEvery = 10, int majorOffset = 0, double tickSpacing = 12.0, ValueChanged<
double> ? onChanged, ValueChanged<double> ? onChangeEnd, String labelBuilder(double value)?, ColorRoleToken color = ColorRoleToken.accent, bool disabled = false}) -
Creates a Dial.
const
Properties
- color → ColorRoleToken
-
Color role of the center indicator.
final
- controller → DialController?
-
Holds the value instead of value and moves the dial from outside.
final
- disabled → bool
-
Dims the dial and blocks interaction.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- labelBuilder → String Function(double value)?
-
Text shown under the labelled ticks and read by screen readers. Defaults to the value itself.
final
- majorEvery → int
-
Number of ticks between labelled ticks, counted from min.
final
- majorOffset → int
-
Number of ticks the labelled ticks are shifted forward by, so a dial that
starts at 1 can still label 10, 20, 30.
final
- max → double
-
Largest value.
final
- min → double
-
Smallest value.
final
-
onChanged
→ ValueChanged<
double> ? -
Called with the new value each time the dial moves onto a different tick.
final
-
onChangeEnd
→ ValueChanged<
double> ? -
Called with the final value each time the dial comes to rest.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- step → double
-
Value difference between two neighbouring ticks.
final
- tickSpacing → double
-
Distance in logical pixels between two neighbouring ticks.
final
- value → double?
-
The value under the indicator. Snapped to the nearest tick and clamped to min and max.
Ignored when a controller is given.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< Dial> -
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