FlutterRating class
FlutterRating is a widget that displays a rating bar. The rating bar can be customized by changing the starCount, size, rating, mainAxisAlignment, allowHalfRating, borderColor, color, onRatingChanged
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- FlutterRating
Constructors
- FlutterRating({Key? key, int starCount = 5, double rating = 0.0, RatingChangeCallback? onRatingChanged, Color color = Colors.amber, Color borderColor = Colors.grey, double? size, bool allowHalfRating = false, MainAxisAlignment mainAxisAlignment = MainAxisAlignment.center})
-
const
Properties
- allowHalfRating → bool
-
allowHalfRating is a boolean value that determines if the rating can be
a half value.
allowHalfRating defaults value is false.
final
- borderColor → Color
-
borderColor is the color of the border of the stars.
borderColor defaults value is Colors.grey.
final
- color → Color
-
color is the color of the filled stars.
color defaults value is Colors.amber.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- mainAxisAlignment → MainAxisAlignment
-
mainAxisAlignment is the alignment of the stars.
mainAxisAlignment defaults value is MainAxisAlignment.start.
final
- onRatingChanged → RatingChangeCallback?
-
onRatingChanged is the callback when the user selects a new rating.
final
- rating → double
-
rating is the current rating.
rating defaults value is 0.0.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → double?
-
size is the size of the stars.
size defaults value is MediaQuery.of(context).size.width / starCount.
final
- starCount → int
-
starCount is the number of stars to display.
starCount defaults value is 5.
final
Methods
-
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
buildStar(
BuildContext context, int index) → dynamic -
buildStar is a method that returns stars.
index
is the index of the star. buildStar returns a GestureDetector that contains a Icon. If allowHalfRating is true, the star is filled if the rating is greater than or equal to the index of the star. If allowHalfRating is false, the star is filled if the rating is greater than the index of the star. If onRatingChanged is not null, the GestureDetector is clickable. If onRatingChanged is null, the GestureDetector is not clickable. If the user clicks on the star, the onRatingChanged method is called. -
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