确认变色逻辑
This commit is contained in:
@@ -789,31 +789,35 @@ 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: TextStyle(
|
||||||
fontSize: 40,
|
fontSize: 40,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
height: 1.0,
|
height: 1.0,
|
||||||
color: healthPercent < 70 ? Colors.red : Colors.black, // 🟢 动态颜色
|
color: healthPercent < 70
|
||||||
|
? Colors.red
|
||||||
|
: Colors.black, // 🟢 动态颜色
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 2),
|
||||||
|
Text(
|
||||||
|
'%',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.w300,
|
||||||
|
height: 1.0,
|
||||||
|
color: healthPercent < 70
|
||||||
|
? Colors.red
|
||||||
|
: 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,
|
||||||
|
|||||||
Reference in New Issue
Block a user