1.优化补足了首页下拉刷新中对获取场站接口的加入,确保能够实时获取数据并渲染。
2.优化修改了tcp重连机制,具体操作:断开重连时候不再建立新链接 而是将旧链接重置,并重新发送数据。 3.大面积的给项目中的各个页面 手动接入了多语言的支持。同时也调整了相应带来的问题英文长度较大影响原有的样式的问题,已解决了对应的样式不和谐问题。保证了外观的统一性。 4.给项目中的主要操作加了几个核心的操作比如远程遥控和路径规划添加了双层的保护,设置里安全模式,即在此期间对服务器推送的重复登录操作后的自动退出登录做一个拦截 保证操作的安全性。
This commit is contained in:
@@ -17,10 +17,7 @@ class DeviceBottomNavBar extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: const Color(0xFFF2F3F5),
|
||||
width: 0.5,
|
||||
),
|
||||
top: BorderSide(color: const Color(0xFFF2F3F5), width: 0.5),
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
@@ -79,7 +76,9 @@ class DeviceBottomNavBar extends StatelessWidget {
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
color: isSelected ? const Color(0xFF004CFD) : const Color(0xFF86909C),
|
||||
color: isSelected
|
||||
? const Color(0xFF004CFD)
|
||||
: const Color(0xFF86909C),
|
||||
size: 24,
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
@@ -87,7 +86,9 @@ class DeviceBottomNavBar extends StatelessWidget {
|
||||
label,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: isSelected ? const Color(0xFF004FFF) : const Color(0xFF86909C),
|
||||
color: isSelected
|
||||
? const Color(0xFF004FFF)
|
||||
: const Color(0xFF86909C),
|
||||
fontWeight: isSelected ? FontWeight.w500 : FontWeight.normal,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../domain/entities/device_entity.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
|
||||
/// 设备列表项 Widget
|
||||
class DeviceItemWidget extends StatelessWidget {
|
||||
@@ -68,7 +69,7 @@ class DeviceItemWidget extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
// 第二行:设备数据
|
||||
_buildDeviceData(device),
|
||||
_buildDeviceData(context, device),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -112,11 +113,7 @@ class DeviceItemWidget extends StatelessWidget {
|
||||
color: color.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
color: color,
|
||||
size: 28,
|
||||
),
|
||||
child: Icon(icon, color: color, size: 28),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -148,46 +145,71 @@ class DeviceItemWidget extends StatelessWidget {
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
),
|
||||
child: Text(
|
||||
status,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: textColor,
|
||||
),
|
||||
),
|
||||
child: Text(status, style: TextStyle(fontSize: 12, color: textColor)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDeviceData(DeviceEntity device) {
|
||||
Widget _buildDeviceData(BuildContext context, DeviceEntity device) {
|
||||
final dataItems = <Widget>[];
|
||||
|
||||
// 根据设备类型显示不同的数据
|
||||
if (device.type == '逆变器') {
|
||||
dataItems.add(_buildDataItem('${device.power}', 'kW | 功率'));
|
||||
if (device.type == 'inverter') {
|
||||
dataItems.add(
|
||||
_buildDataItem(
|
||||
'${device.power}',
|
||||
'${AppLocalizations.of(context).translate('device_list_v2.inverter')} | ${AppLocalizations.of(context).translate('device_list_v2.power')}',
|
||||
),
|
||||
);
|
||||
dataItems.add(const SizedBox(width: 16));
|
||||
dataItems.add(_buildDataItem('${device.todayEnergy}', 'kWh | 今日发电'));
|
||||
} else if (device.type == '汇流箱') {
|
||||
dataItems.add(
|
||||
_buildDataItem(
|
||||
'${device.todayEnergy}',
|
||||
'${AppLocalizations.of(context).translate('device_list_v2.today_energy')}',
|
||||
),
|
||||
);
|
||||
} else if (device.type == 'combiner_box') {
|
||||
if (device.current != null) {
|
||||
dataItems.add(_buildDataItem('${device.current}', 'A | 电流'));
|
||||
dataItems.add(
|
||||
_buildDataItem(
|
||||
'${device.current}',
|
||||
'${AppLocalizations.of(context).translate('device_list_v2.current')}',
|
||||
),
|
||||
);
|
||||
dataItems.add(const SizedBox(width: 16));
|
||||
}
|
||||
if (device.temperature != null) {
|
||||
dataItems.add(_buildDataItem('${device.temperature}', '℃ | 温度'));
|
||||
dataItems.add(
|
||||
_buildDataItem(
|
||||
'${device.temperature}',
|
||||
'${AppLocalizations.of(context).translate('device_list_v2.temperature')}',
|
||||
),
|
||||
);
|
||||
}
|
||||
} else if (device.type == '组件') {
|
||||
dataItems.add(_buildDataItem('${device.power}', 'kW | 功率'));
|
||||
} else if (device.type == 'module') {
|
||||
dataItems.add(
|
||||
_buildDataItem(
|
||||
'${device.power}',
|
||||
'${AppLocalizations.of(context).translate('device_list_v2.power')}',
|
||||
),
|
||||
);
|
||||
dataItems.add(const SizedBox(width: 16));
|
||||
if (device.radiation != null) {
|
||||
dataItems.add(_buildDataItem('${device.radiation}', 'W/m² | 辐照度'));
|
||||
dataItems.add(
|
||||
_buildDataItem(
|
||||
'${device.radiation}',
|
||||
'${AppLocalizations.of(context).translate('device_list_v2.radiation')}',
|
||||
),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// 监控等其他类型
|
||||
dataItems.add(_buildDataItem('--', '数据'));
|
||||
dataItems.add(
|
||||
_buildDataItem(
|
||||
'--',
|
||||
'${AppLocalizations.of(context).translate('device_list_v2.data')}',
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Row(
|
||||
children: dataItems,
|
||||
);
|
||||
return Row(children: dataItems);
|
||||
}
|
||||
|
||||
Widget _buildDataItem(String value, String unit) {
|
||||
@@ -205,10 +227,7 @@ class DeviceItemWidget extends StatelessWidget {
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
unit,
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF4E5969),
|
||||
),
|
||||
style: const TextStyle(fontSize: 12, color: Color(0xFF4E5969)),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
|
||||
/// 机器人卡片组件
|
||||
class RobotItemCard extends StatelessWidget {
|
||||
@@ -83,7 +84,9 @@ class RobotItemCard extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
alias != null && alias!.isNotEmpty ? '别名: $alias' : 'ID: $id',
|
||||
alias != null && alias!.isNotEmpty
|
||||
? '别名: $alias'
|
||||
: 'ID: $id',
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF86909C),
|
||||
@@ -111,14 +114,14 @@ class RobotItemCard extends StatelessWidget {
|
||||
battery > 50
|
||||
? Icons.battery_full
|
||||
: battery > 20
|
||||
? Icons.battery_std
|
||||
: Icons.battery_alert,
|
||||
? Icons.battery_std
|
||||
: Icons.battery_alert,
|
||||
size: 16,
|
||||
color: battery > 50
|
||||
? const Color(0xFF00B42A)
|
||||
: battery > 20
|
||||
? const Color(0xFFFF7D00)
|
||||
: const Color(0xFFF53F3F),
|
||||
? const Color(0xFFFF7D00)
|
||||
: const Color(0xFFF53F3F),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
@@ -129,15 +132,17 @@ class RobotItemCard extends StatelessWidget {
|
||||
color: battery > 50
|
||||
? const Color(0xFF00B42A)
|
||||
: battery > 20
|
||||
? const Color(0xFFFF7D00)
|
||||
: const Color(0xFFF53F3F),
|
||||
? const Color(0xFFFF7D00)
|
||||
: const Color(0xFFF53F3F),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
const Text(
|
||||
'电量',
|
||||
Text(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('device_list_v2.battery_level'),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF4E5969),
|
||||
@@ -162,8 +167,10 @@ class RobotItemCard extends StatelessWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
const Text(
|
||||
'当前任务',
|
||||
Text(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('device_list_v2.current_task'),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF4E5969),
|
||||
@@ -208,23 +215,17 @@ class RobotItemCard extends StatelessWidget {
|
||||
color: bgColor,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Text(
|
||||
status,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: textColor,
|
||||
),
|
||||
),
|
||||
child: Text(status, style: TextStyle(fontSize: 12, color: textColor)),
|
||||
);
|
||||
}
|
||||
|
||||
String _getRobotImage() {
|
||||
switch (type) {
|
||||
case '巡检机器人':
|
||||
case 'inspection':
|
||||
return 'assets/images/xunjian.png';
|
||||
case '清洗机器人':
|
||||
case 'cleaning':
|
||||
return 'assets/images/qinxi.png';
|
||||
case '除草机器人':
|
||||
case 'weeding':
|
||||
return 'assets/images/chucao.png';
|
||||
default:
|
||||
return 'assets/images/xunjian.png';
|
||||
|
||||
Reference in New Issue
Block a user