StarRatingDisplay class

A read-only star rating display widget. It animates from 0 up to rating (which can be fractional, e.g. 3.2).

Inheritance

Constructors

StarRatingDisplay({Key? key, int starCount = 5, required double rating, Duration animationDuration = const Duration(milliseconds: 1000), double starSize = 40.0, double starSpacing = 4.0, Color selectedFillColor = Colors.amber, bool showSelectedBorder = true, Color selectedStrokeColor = Colors.amber, double selectedStrokeWidth = 2.0, Color unselectedStrokeColor = Colors.grey, double unselectedStrokeWidth = 2.0, StarEdgeShape starEdgeShape = StarEdgeShape.smooth, BoxDecoration? decoration})
const

Properties

animationDuration → Duration
The duration of the "fill" animation from 0.0 up to rating.
final
decoration → BoxDecoration?
Decoration for the container that holds the entire row of stars.
final
hashCode → int
The hash code for this object.
no setterinherited
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
rating → double
The final rating to display (e.g., 3.2 means 3 full stars + 0.2 partial).
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
selectedFillColor → Color
The color used to fill any portion of a star.
final
selectedStrokeColor → Color
The stroke color for partially/fully filled stars (only used if showSelectedBorder == true).
final
selectedStrokeWidth → double
The stroke width for partially/fully filled stars (only used if showSelectedBorder == true).
final
showSelectedBorder → bool
Whether to show a border around partially/fully filled stars.
final
starCount → int
The total number of stars. Default is 5.
final
starEdgeShape → StarEdgeShape
Sharp or smooth corners for the star’s edges.
final
starSize → double
The size (width/height) of each star.
final
starSpacing → double
The spacing between adjacent stars.
final
unselectedStrokeColor → Color
The stroke color for stars with zero fill.
final
unselectedStrokeWidth → double
The stroke width for stars with zero fill.
final

Methods

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