UIRatingBar class

Interactive star (or custom) rating bar with optional half-star support.

Use UIRatingBar.builder when each item should be built individually.

Inheritance

Constructors

UIRatingBar({Key? key, required double initialRating, UIRatingWidget? ratingWidget, ValueChanged<double>? onRatingUpdate, int itemCount = 5, double minRating = 0, Axis direction = Axis.horizontal, bool allowHalfRating = true, EdgeInsetsGeometry itemPadding = EdgeInsets.zero, double itemSize = 24, Color? filledColor, Color? emptyColor, bool tapEnabled = true, bool updateOnDrag = true, String semanticsLabel = 'Rating'})
Creates a UIRatingBar with a fixed ratingWidget for every item.
const
UIRatingBar.builder({Key? key, required double initialRating, required UIRatingItemBuilder? itemBuilder, ValueChanged<double>? onRatingUpdate, int itemCount = 5, double minRating = 0, Axis direction = Axis.horizontal, bool allowHalfRating = true, EdgeInsetsGeometry itemPadding = EdgeInsets.zero, double itemSize = 24, Color? filledColor, Color? emptyColor, bool tapEnabled = true, bool updateOnDrag = true, String semanticsLabel = 'Rating'})
Creates a UIRatingBar with a per-index itemBuilder.
const

Properties

allowHalfRating bool
Whether half-step ratings are allowed.
final
direction Axis
Layout direction of the rating items.
final
emptyColor Color?
Color for empty stars when using the built-in star widget.
final
filledColor Color?
Color for filled stars when using the built-in star widget.
final
hashCode int
The hash code for this object.
no setterinherited
initialRating double
Starting rating value.
final
itemBuilder → UIRatingItemBuilder?
Builds each rating item; supports per-index customization.
final
itemCount int
Number of rating items.
final
itemPadding EdgeInsetsGeometry
Padding around each item.
final
itemSize double
Default icon size when using the built-in star widget.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
minRating double
Minimum selectable rating.
final
onRatingUpdate ValueChanged<double>?
Called when the user changes the rating.
final
ratingWidget UIRatingWidget?
Fixed full/half/empty widgets for every item.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticsLabel String
Accessibility label announced by screen readers for the rating control.
final
tapEnabled bool
Whether taps update the rating.
final
updateOnDrag bool
Whether dragging across items updates the rating.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<UIRatingBar>
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