What I have:

What I want:

I am using flutter_rating_bar package and I want it to show the unselected containers as is instead of the default grey color and only want to change the color for the selected container.
As shown in the above pictures, instead of the grey boxes I want to display the remaining unselected containers preceding the selected ones as shown in the second picture.
Code:
RatingBar.builder(
initialRating: initialRatings,
itemCount: 5,
itemSize: 50,
itemPadding: EdgeInsets.symmetric(horizontal: containerWidth * 0.0077),
itemBuilder: (context, index) {
switch (index) {
case 0:
return Container(
width: ratingContainerWidth,
height: ratingContainerHeight,
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
bottomLeft: Radius.circular(8),
bottomRight: Radius.circular(8),
),
color: knowledgeRating == 1
? const Color.fromRGBO(109, 44, 237, 1)
: const Color.fromRGBO(226, 243, 255, 1),
),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
child: Text(
'1',
textAlign: TextAlign.left,
style: TextStyle(
color: knowledgeRating == 1
? const Color.fromRGBO(255, 255, 255, 1)
: const Color.fromRGBO(0, 0, 0, 1),
fontFamily: 'Inter',
fontSize: 16,
letterSpacing: 0.20000000298023224,
fontWeight: FontWeight.bold,
),
),
);
case 1:
return Container(
width: ratingContainerWidth,
height: ratingContainerHeight,
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
bottomLeft: Radius.circular(8),
bottomRight: Radius.circular(8),
),
color: knowledgeRating == 2
? const Color.fromRGBO(109, 44, 237, 1)
: const Color.fromRGBO(226, 243, 255, 1),
),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
child: Text(
'2',
textAlign: TextAlign.left,
style: TextStyle(
color: knowledgeRating == 2
? const Color.fromRGBO(255, 255, 255, 1)
: const Color.fromRGBO(0, 0, 0, 1),
fontFamily: 'Inter',
fontSize: 16,
letterSpacing: 0.20000000298023224,
fontWeight: FontWeight.bold,
),
),
);
case 2:
return Container(
width: ratingContainerWidth,
height: ratingContainerHeight,
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
bottomLeft: Radius.circular(8),
bottomRight: Radius.circular(8),
),
color: knowledgeRating == 3
? const Color.fromRGBO(109, 44, 237, 1)
: const Color.fromRGBO(226, 243, 255, 1),
),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
child: Text(
'3',
textAlign: TextAlign.left,
style: TextStyle(
color: knowledgeRating == 3
? const Color.fromRGBO(255, 255, 255, 1)
: const Color.fromRGBO(0, 0, 0, 1),
fontFamily: 'Inter',
fontSize: 16,
letterSpacing: 0.20000000298023224,
fontWeight: FontWeight.bold,
),
),
);
case 3:
return Container(
width: ratingContainerWidth,
height: ratingContainerHeight,
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
bottomLeft: Radius.circular(8),
bottomRight: Radius.circular(8),
),
color: knowledgeRating == 4
? const Color.fromRGBO(109, 44, 237, 1)
: const Color.fromRGBO(226, 243, 255, 1),
),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
child: Text(
'4',
textAlign: TextAlign.left,
style: TextStyle(
color: knowledgeRating == 4
? const Color.fromRGBO(255, 255, 255, 1)
: const Color.fromRGBO(0, 0, 0, 1),
fontFamily: 'Inter',
fontSize: 16,
letterSpacing: 0.20000000298023224,
fontWeight: FontWeight.bold,
),
),
);
case 4:
return Container(
width: ratingContainerWidth,
height: ratingContainerHeight,
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
bottomLeft: Radius.circular(8),
bottomRight: Radius.circular(8),
),
color: knowledgeRating == 5
? const Color.fromRGBO(109, 44, 237, 1)
: const Color.fromRGBO(226, 243, 255, 1),
),
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
child: Text(
'5',
textAlign: TextAlign.left,
style: TextStyle(
color: knowledgeRating == 5
? const Color.fromRGBO(255, 255, 255, 1)
: const Color.fromRGBO(0, 0, 0, 1),
fontFamily: 'Inter',
fontSize: 16,
letterSpacing: 0.20000000298023224,
fontWeight: FontWeight.bold,
),
),
);
default:
return Container();
}
},
onRatingUpdate: (rating) => setState(() {
knowledgeRating = rating;
}),
),
