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