DesignRating class
A rating of itemCount items filled up to value (0, none, to itemCount): onChanged gets the value a tap, a drag, a key or a screen reader sets.
A tap sets the item tapped (its first half, a half, with allowHalf; mirrored right to left); a tap on the value already set changes nothing. Hovering previews the value a tap would set; a drag sweeps across, changing it as it goes, a step played at each (DesignHaptics.selectionChanged). Keys (a single tab stop): Right and Up step up, Left and Down back (Right and Left as drawn, so mirrored right to left), End sets itemCount, Home or 0 clears it, a digit sets that many. A screen reader hears a slider, "Rating, 3 of 5" (DesignLocalizations.ratingValueLabel), and steps it.
readOnly shows a value (an average of 3.7): no input and no tab stop, read as a value, not as disabled.
DesignRating(value: 3, onChanged: (value) {}, itemBuilder: (context, item) => Text(item.fill >= 1 ? '★' : '☆'))
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- DesignRating
Constructors
-
DesignRating({Key? key, required double value, required ValueChanged<
double> ? onChanged, required DesignRatingItemBuilder itemBuilder, int itemCount = 5, bool allowHalf = false, bool readOnly = false, DesignRatingLayoutBuilder? layoutBuilder, ValueChanged<double> ? onChangeStart, ValueChanged<double> ? onChangeEnd, String? semanticLabel, String semanticFormatterCallback(double value)?, FocusNode? focusNode, bool autofocus = false, MouseCursor? mouseCursor}) -
A rating showing
value.const
Properties
- allowHalf → bool
-
Whether a value can end in a half: from where the pointer lands, and
in the keys' and a screen reader's steps. Defaults to false.
final
- autofocus → bool
-
Whether the rating takes focus when it first shows.
final
- focusNode → FocusNode?
-
The rating's focus; null: its own.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- itemBuilder → DesignRatingItemBuilder
-
Paints an item.
final
- itemCount → int
-
How many items. Defaults to 5.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- layoutBuilder → DesignRatingLayoutBuilder?
-
Lays out the items; null: a Row in reading order.
final
- mouseCursor → MouseCursor?
-
The pointer's cursor over it; null: a click cursor while it takes
input.
final
-
onChanged
→ ValueChanged<
double> ? -
Called with each value set, a drag's as it moves.
final
-
onChangeEnd
→ ValueChanged<
double> ? -
Called with the value as a change ends (a release, a key).
final
-
onChangeStart
→ ValueChanged<
double> ? -
Called with the value as a change begins (a press, a drag, a key).
final
- readOnly → bool
-
Whether it only shows value: no input, no tab stop, read as a value
rather than as disabled. Defaults to false.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticFormatterCallback → String Function(double value)?
-
How a screen reader says a value; null: "3.5 of 5" in the reader's
numbers (DesignLocalizations.ratingValueLabel).
final
- semanticLabel → String?
-
What a screen reader calls it; null: "Rating"
(DesignLocalizations.ratingLabel).
final
- value → double
-
How many items are filled, 0 to itemCount; any fraction shows.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< DesignRating> -
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