RatingStar class

星级评分控件,支持:

  • 可自定义图片、颜色、大小、间距
  • 支持点击选中
  • 支持是否限制评分最少一颗星,即第一颗星支持是否可反选
  • 支持半颗星(仅支持展示,不支持选择)
Inheritance

Constructors

RatingStar({Key? key, int count = DEFAULT_COUNT, double selectedCount = 0, double space = DEFAULT_SPACE, RatingStarBuilder? starBuilder, ValueChanged<double>? onSelected, Color? color = const Color(0xFFF0F0F0), Color? activeColor, bool canRatingZero = false, double size = 16.0})
const

Properties

activeColor Color?
final
canRatingZero bool
是否可评 0 颗星,即第一颗星是否支持反选,默认不可评 0 星
final
color Color?
final
count int
星星的总数,默认为 5 颗
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onSelected ValueChanged<double>?
如果设置了,就支持编辑
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectedCount double
初始选中个数
final
size double
final
space double
星星间的水平间距,默认为 1.0
final
starBuilder RatingStarBuilder?
单颗星星视图的自定义构造器
final

Methods

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

Constants

DEFAULT_COUNT → const int
DEFAULT_SPACE → const double