RatingSummary class

A widget that displays a summary of a rating.

Example:

RatingSummary(
  counter: 13,
  average: 3.846,
  counterFiveStars: 5,
  counterFourStars: 4,
  counterThreeStars: 2,
  counterTwoStars: 1,
  counterOneStars: 1,
)
Inheritance

Constructors

RatingSummary({Key? key, required int counter, double average = 0.0, bool showAverage = true, TextStyle averageStyle = const TextStyle(fontWeight: FontWeight.bold, fontSize: 40), int counterFiveStars = 0, int counterFourStars = 0, int counterThreeStars = 0, int counterTwoStars = 0, int counterOneStars = 0, String labelCounterFiveStars = '5', String labelCounterFourStars = '4', String labelCounterThreeStars = '3', String labelCounterTwoStars = '2', String labelCounterOneStars = '1', TextStyle labelCounterFiveStarsStyle = const TextStyle(fontSize: 14, fontWeight: FontWeight.bold), TextStyle labelCounterFourStarsStyle = const TextStyle(fontSize: 14, fontWeight: FontWeight.bold), TextStyle labelCounterThreeStarsStyle = const TextStyle(fontSize: 14, fontWeight: FontWeight.bold), TextStyle labelCounterTwoStarsStyle = const TextStyle(fontSize: 14, fontWeight: FontWeight.bold), TextStyle labelCounterOneStarsStyle = const TextStyle(fontSize: 14, fontWeight: FontWeight.bold), String label = 'Ratings', TextStyle labelStyle = const TextStyle(fontWeight: FontWeight.w600), Color color = Colors.amber, Color backgroundColor = const Color(0xFFEEEEEE)})
const

Properties

average double
The average rating.
final
averageStyle TextStyle
The style of the average rating.
final
backgroundColor Color
The color of the unused stars and the background of the horizontal bar _ReviewBar.
final
color Color
The color of the stars and the horizontal bar _ReviewBar.
final
counter int
The total number of ratings.
final
counterFiveStars int
The number of ratings with 5 stars.
final
counterFourStars int
The number of ratings with 4 stars.
final
counterOneStars int
The number of ratings with 1 stars.
final
counterThreeStars int
The number of ratings with 3 stars.
final
counterTwoStars int
The number of ratings with 2 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
label String
The label of the counter
final
labelCounterFiveStars String
The label of the counterFiveStars.
final
labelCounterFiveStarsStyle TextStyle
The style of the labelCounterFiveStars.
final
labelCounterFourStars String
The label of the counterFourStars.
final
labelCounterFourStarsStyle TextStyle
The style of the labelCounterFourStars.
final
labelCounterOneStars String
The label of the counterOneStars.
final
labelCounterOneStarsStyle TextStyle
The style of the labelCounterOneStars.
final
labelCounterThreeStars String
The label of the counterThreeStars.
final
labelCounterThreeStarsStyle TextStyle
The style of the labelCounterThreeStars.
final
labelCounterTwoStars String
The label of the counterTwoStars.
final
labelCounterTwoStarsStyle TextStyle
The style of the labelCounterTwoStars.
final
labelStyle TextStyle
The style of the label.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
showAverage bool
Whether to show the average rating.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
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}) 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