准备更新temp_avg相关字段能力

This commit is contained in:
2026-09-16 20:47:19 +08:00
parent 68e7be98ed
commit 75e9e85848
54 changed files with 106 additions and 1217 deletions
+34 -11
View File
@@ -11,6 +11,8 @@ class BatteryInfoPanel extends StatelessWidget {
final double minTemp;
final DataAbnormalType abnormalType;
final double tempAvg;
const BatteryInfoPanel({
super.key,
required this.batteryVolt,
@@ -19,6 +21,7 @@ class BatteryInfoPanel extends StatelessWidget {
required this.minVolt,
required this.maxTemp,
required this.minTemp,
this.tempAvg = 0,
this.abnormalType = DataAbnormalType.none,
});
@@ -110,13 +113,14 @@ class BatteryInfoPanel extends StatelessWidget {
'${batteryTemp.toStringAsFixed(0)}℃',
),
const SizedBox(height: 8),
// 🆕 一行显示:↑ max ↓ min [avg] avg
Row(
children: [
RichText(
text: TextSpan(
style: const TextStyle(
fontFamily: 'Flyme',
fontSize: 14,
fontSize: 12,
fontWeight: FontWeight.w500,
color: Colors.red,
),
@@ -128,16 +132,16 @@ class BatteryInfoPanel extends StatelessWidget {
color: Colors.red,
),
),
TextSpan(text: '${maxTemp.toStringAsFixed(0)}℃'),
TextSpan(text: '${maxTemp.toStringAsFixed(1)}℃'),
],
),
),
const SizedBox(width: 12),
const SizedBox(width: 6),
RichText(
text: TextSpan(
style: const TextStyle(
fontFamily: 'Flyme',
fontSize: 14,
fontSize: 12,
fontWeight: FontWeight.w500,
color: Colors.blue,
),
@@ -149,10 +153,22 @@ class BatteryInfoPanel extends StatelessWidget {
color: Colors.blue,
),
),
TextSpan(text: '${minTemp.toStringAsFixed(0)}℃'),
TextSpan(text: '${minTemp.toStringAsFixed(1)}℃'),
],
),
),
const SizedBox(width: 6),
_buildIcon('avg', size: 14),
const SizedBox(width: 2),
Text(
'${tempAvg.toStringAsFixed(1)}℃',
style: const TextStyle(
fontFamily: 'Flyme',
fontSize: 12,
fontWeight: FontWeight.w500,
color: Colors.grey,
),
),
],
),
],
@@ -162,24 +178,31 @@ class BatteryInfoPanel extends StatelessWidget {
);
}
Widget _buildIcon(String type) {
Widget _buildIcon(String type, {double size = 18}) {
switch (type) {
case 'voltage':
return SvgPicture.asset(
'assets/icons/si--lightning-fill.svg',
width: 18,
height: 18,
width: size,
height: size,
colorFilter: const ColorFilter.mode(Colors.grey, BlendMode.srcIn),
);
case 'temperature':
return SvgPicture.asset(
'assets/icons/mdi--temperature.svg',
width: 18,
height: 18,
width: size,
height: size,
colorFilter: const ColorFilter.mode(Colors.grey, BlendMode.srcIn),
);
case 'avg': // 🆕
return SvgPicture.asset(
'assets/icons/avg.svg',
width: size,
height: size,
colorFilter: const ColorFilter.mode(Colors.grey, BlendMode.srcIn),
);
default:
return const Icon(Icons.help_outline, size: 18, color: Colors.grey);
return Icon(Icons.help_outline, size: size, color: Colors.grey);
}
}