Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 49d4127ad9 |
@@ -789,31 +789,30 @@ class _BatteryHealthPageState extends State<BatteryHealthPage>
|
|||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.baseline,
|
crossAxisAlignment: CrossAxisAlignment.baseline,
|
||||||
textBaseline: TextBaseline.alphabetic,
|
textBaseline: TextBaseline.alphabetic,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
healthPercent.toStringAsFixed(1),
|
healthPercent.toStringAsFixed(1),
|
||||||
style: TextStyle(
|
style: const TextStyle(
|
||||||
fontSize: 40,
|
fontSize: 40,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
height: 1.0,
|
height: 1.0,
|
||||||
color: healthPercent < 70 ? Colors.red : Colors.black, // 🟢 动态颜色
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 2),
|
||||||
|
Text(
|
||||||
|
'%',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w300,
|
||||||
|
height: 1.0,
|
||||||
|
color: Colors.grey.shade600,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
const SizedBox(width: 2),
|
|
||||||
Text(
|
|
||||||
'%',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.w300,
|
|
||||||
height: 1.0,
|
|
||||||
color: healthPercent < 70 ? Colors.red : Colors.grey.shade600, // 🟢 动态颜色
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
@@ -1036,18 +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 >= 70) {
|
} else if (value >= 70) {
|
||||||
barColor = kHealthYellow;
|
barColor = kHealthYellow;
|
||||||
} else {
|
} else {
|
||||||
barColor = Colors.red; // 🟢 小于 70 显示红色
|
barColor = Colors.red; // 🟢 小于 70 显示红色
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
barColor = Colors.grey.shade300;
|
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;
|
||||||
|
|||||||
+1
-1
@@ -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
|
# 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
|
# 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.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 1.3.0
|
version: 1.2.0-dev.3
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.9.2
|
sdk: ^3.9.2
|
||||||
|
|||||||
Reference in New Issue
Block a user