趋势图逻辑改动
This commit is contained in:
@@ -1035,17 +1035,18 @@ class _BatteryHealthPageState extends State<BatteryHealthPage>
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: List.generate(percents.length, (index) {
|
||||
double value = percents[index];
|
||||
Color barColor;
|
||||
if (value > 0) {
|
||||
if (value >= 80)
|
||||
barColor = kHealthGreen;
|
||||
else if (value >= 60)
|
||||
barColor = kHealthYellow;
|
||||
else
|
||||
barColor = kHealthOrange;
|
||||
} else {
|
||||
barColor = Colors.grey.shade300;
|
||||
}
|
||||
Color barColor;
|
||||
if (value > 0) {
|
||||
if (value >= 80) {
|
||||
barColor = kHealthGreen;
|
||||
} else if (value >= 70) {
|
||||
barColor = kHealthYellow;
|
||||
} else {
|
||||
barColor = Colors.red; // 🟢 小于 70 显示红色
|
||||
}
|
||||
} else {
|
||||
barColor = Colors.grey.shade300;
|
||||
}
|
||||
double clampedValue = value.clamp(70.0, 100.0);
|
||||
double heightFactor =
|
||||
(clampedValue - 70.0) / 30.0;
|
||||
|
||||
Reference in New Issue
Block a user