buildStar method

Widget buildStar(
  1. BuildContext context,
  2. int index
)

Implementation

Widget buildStar(BuildContext context, int index) {
  Icon icon;
  if (index >= rating) {
    icon = new Icon(
      Icons.star_border,
      color: Theme.of(context).buttonColor,
      size: size,
    );
  } else if (index > rating - 1 && index < rating) {
    icon = new Icon(
      Icons.star_half,
      color: color ?? Theme.of(context).primaryColor,
      size: size,
    );
  } else {
    icon = new Icon(
      Icons.star,
      color: color ?? Theme.of(context).primaryColor,
      size: size,
    );
  }
  return new InkResponse(
    onTap: onRatingChanged == null ? null : () => onRatingChanged!(index + 1.0),
    child: icon,
  );
}