Tuesday, April 9, 2024

Start Icon print If Statement is correct

 Start Icon print If Statement is correct

Excellent                ⭐⭐⭐

good                                    ⭐⭐

not bad                                



Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// First star (always active)
CircleAvatar(
radius: 20,
backgroundColor: Colors.red,
child: Icon(Icons.star, color: Colors.white, size: 30),
),

SizedBox(width: 10),

// Second star (conditionally active based on Utilities.timerMessage)
CircleAvatar(
radius: 20,
backgroundColor: Utilities.timerMessage == "Excellent" || Utilities.timerMessage == "Good" ? Colors.red : Colors.grey,
child: Icon(Icons.star, color: Colors.white, size: 30),
),

SizedBox(width: 10),

// Third star (conditionally active based on Utilities.timerMessage)
CircleAvatar(
radius: 20,
backgroundColor: Utilities.timerMessage == "Excellent" ? Colors.red : Colors.grey,
child: Icon(Icons.star, color: Colors.white, size: 30),
),
],
),



Excellent                ⭐⭐⭐

good                                    

not bad                                



Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// Conditionally show the first star
Utilities.timerMessage == "Not Bad" || Utilities.timerMessage == "Good" || Utilities.timerMessage == "Excellent" ?
radius: 20,
      backgroundColor: Colors.red,
child: Icon(Icons.star, color: Colors.white, size: 30),
) : SizedBox(),

SizedBox(width: 10),

// Conditionally show the second star
Utilities.timerMessage == "Good" || Utilities.timerMessage == "Excellent" ?
CircleAvatar(
radius: 20,
backgroundColor: Utilities.timerMessage == "Excellent" ? Colors.red : Colors.grey, // Set color based on active/inactive status
child: Icon(Icons.star, color: Colors.white, size: 30),
) : SizedBox(),

SizedBox(width: 10),

// Conditionally show the third star
Utilities.timerMessage == "Excellent" ?
CircleAvatar(
radius: 20,
backgroundColor: Colors.red,
child: Icon(Icons.star, color: Colors.white, size: 30),
) : SizedBox(),
],
)

No comments:

Post a Comment

Featured post

Compress Image With Show File Size & Resolution in Flutter

 Compress Image With Show File Size & Resolution  1.Multiple File Image Compress with file Size import 'dart:io' ; import 'p...

LightBlog