增加作弊数据检测
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import '../models/data_abnormal_type.dart';
|
||||
|
||||
class BatteryInfoPanel extends StatelessWidget {
|
||||
final double batteryVolt;
|
||||
@@ -8,6 +9,7 @@ class BatteryInfoPanel extends StatelessWidget {
|
||||
final double minVolt;
|
||||
final double maxTemp;
|
||||
final double minTemp;
|
||||
final DataAbnormalType abnormalType;
|
||||
|
||||
const BatteryInfoPanel({
|
||||
super.key,
|
||||
@@ -17,10 +19,15 @@ class BatteryInfoPanel extends StatelessWidget {
|
||||
required this.minVolt,
|
||||
required this.maxTemp,
|
||||
required this.minTemp,
|
||||
this.abnormalType = DataAbnormalType.none,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bool isVoltageAbnormal =
|
||||
abnormalType == DataAbnormalType.voltageAbnormal;
|
||||
final Color voltColor = isVoltageAbnormal ? Colors.red : Colors.black;
|
||||
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@@ -32,6 +39,7 @@ class BatteryInfoPanel extends StatelessWidget {
|
||||
_buildIcon('voltage'),
|
||||
'电压',
|
||||
'${batteryVolt.toStringAsFixed(3)}V',
|
||||
textColor: voltColor,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Row(
|
||||
@@ -52,7 +60,12 @@ class BatteryInfoPanel extends StatelessWidget {
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
TextSpan(text: '${maxVolt.toStringAsFixed(3)}V'),
|
||||
TextSpan(
|
||||
text: '${maxVolt.toStringAsFixed(3)}V',
|
||||
style: TextStyle(
|
||||
color: isVoltageAbnormal ? Colors.red : Colors.red,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -73,7 +86,12 @@ class BatteryInfoPanel extends StatelessWidget {
|
||||
color: Colors.blue,
|
||||
),
|
||||
),
|
||||
TextSpan(text: '${minVolt.toStringAsFixed(3)}V'),
|
||||
TextSpan(
|
||||
text: '${minVolt.toStringAsFixed(3)}V',
|
||||
style: TextStyle(
|
||||
color: isVoltageAbnormal ? Colors.red : Colors.blue,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -96,7 +114,7 @@ class BatteryInfoPanel extends StatelessWidget {
|
||||
children: [
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Flyme',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -117,7 +135,7 @@ class BatteryInfoPanel extends StatelessWidget {
|
||||
const SizedBox(width: 12),
|
||||
RichText(
|
||||
text: TextSpan(
|
||||
style: TextStyle(
|
||||
style: const TextStyle(
|
||||
fontFamily: 'Flyme',
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -165,7 +183,12 @@ class BatteryInfoPanel extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildInfoItem(Widget icon, String label, String value) {
|
||||
Widget _buildInfoItem(
|
||||
Widget icon,
|
||||
String label,
|
||||
String value, {
|
||||
Color textColor = Colors.black,
|
||||
}) {
|
||||
return Row(
|
||||
children: [
|
||||
icon,
|
||||
@@ -181,11 +204,11 @@ class BatteryInfoPanel extends StatelessWidget {
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontFamily: 'Flyme',
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.black,
|
||||
color: textColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user