createRateStar static method

Widget createRateStar(
  1. int totalStar,
  2. int currentStar, {
  3. double size = 10,
  4. Color checkColor = const Color(0xff607AE3),
  5. Color unCheckColor = const Color(0xffe3e3e3),
})

Implementation

static   Widget createRateStar(int totalStar,int currentStar,{double size=10,Color checkColor=const Color(0xff607AE3),Color unCheckColor=const Color(0xffe3e3e3)}){

  List<Widget> stars=[];

  for(int i=0;i<totalStar;i++){
    Color? c=i<currentStar?checkColor:unCheckColor;
    stars.add(Icon(Icons.star,size: size,color: c,));
  }

  return Row(
    children: stars,
  );
}