3 Commits

Author SHA1 Message Date
lxh2875931338 17c728565c 确认变色逻辑 2026-07-04 12:32:42 +08:00
lxh2875931338 64e1a9f910 容量百分比变色显示逻辑优化 2026-07-04 12:30:12 +08:00
lxh2875931338 9d5a53ea1f 趋势图逻辑改动 2026-07-04 12:26:34 +08:00
2 changed files with 20 additions and 15 deletions
+19 -14
View File
@@ -795,10 +795,13 @@ class _BatteryHealthPageState extends State<BatteryHealthPage>
children: [
Text(
healthPercent.toStringAsFixed(1),
style: const TextStyle(
style: TextStyle(
fontSize: 40,
fontWeight: FontWeight.w500,
height: 1.0,
color: healthPercent < 70
? Colors.red
: Colors.black, // 🟢 动态颜色
),
),
const SizedBox(width: 2),
@@ -808,7 +811,9 @@ class _BatteryHealthPageState extends State<BatteryHealthPage>
fontSize: 20,
fontWeight: FontWeight.w300,
height: 1.0,
color: Colors.grey.shade600,
color: healthPercent < 70
? Colors.red
: Colors.grey.shade600, // 🟢 动态颜色
),
),
],
@@ -1035,18 +1040,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 >= 70) {
barColor = kHealthYellow;
} else {
barColor = Colors.red; // 🟢 小于 70 显示红色
}
} 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;
+1 -1
View File
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.2.0-dev.3
version: 1.3.0
environment:
sdk: ^3.9.2