迁移提交
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../domain/entities/device_entity.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
|
||||
|
||||
/// 设备列表项 Widget
|
||||
class DeviceItemWidget extends StatelessWidget {
|
||||
@@ -20,13 +21,13 @@ class DeviceItemWidget extends StatelessWidget {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: context.appColors.cardBackground,
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
boxShadow: const [
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
color: context.appColors.cardShadow,
|
||||
blurRadius: 4,
|
||||
offset: Offset(0, 2),
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -46,25 +47,25 @@ class DeviceItemWidget extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
device.name,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
color: context.appColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'ID: ${device.deviceId}',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF86909C),
|
||||
color: context.appColors.textTertiary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// 状态标签
|
||||
_buildStatusTag(device.status),
|
||||
_buildStatusTag(context, device.status),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
@@ -117,26 +118,26 @@ class DeviceItemWidget extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusTag(String status) {
|
||||
Widget _buildStatusTag(BuildContext context, String status) {
|
||||
Color bgColor;
|
||||
Color textColor;
|
||||
|
||||
switch (status) {
|
||||
case '在线':
|
||||
bgColor = const Color(0xFFF0F9FF);
|
||||
textColor = const Color(0xFF00B42A);
|
||||
bgColor = context.appColors.success.withOpacity(0.1);
|
||||
textColor = context.appColors.success;
|
||||
break;
|
||||
case '离线':
|
||||
bgColor = const Color(0xFFF5F0FF);
|
||||
textColor = const Color(0xFFF53F3F);
|
||||
bgColor = context.appColors.danger.withOpacity(0.1);
|
||||
textColor = context.appColors.danger;
|
||||
break;
|
||||
case '异常':
|
||||
bgColor = const Color(0xFFFFF7E6);
|
||||
textColor = const Color(0xFFFF7D00);
|
||||
bgColor = context.appColors.warning.withOpacity(0.1);
|
||||
textColor = context.appColors.warning;
|
||||
break;
|
||||
default:
|
||||
bgColor = const Color(0xFFF5F5F5);
|
||||
textColor = const Color(0xFF86909C);
|
||||
bgColor = context.appColors.fillBackground;
|
||||
textColor = context.appColors.textTertiary;
|
||||
}
|
||||
|
||||
return Container(
|
||||
@@ -155,6 +156,7 @@ class DeviceItemWidget extends StatelessWidget {
|
||||
if (device.type == 'inverter') {
|
||||
dataItems.add(
|
||||
_buildDataItem(
|
||||
context,
|
||||
'${device.power}',
|
||||
'${AppLocalizations.of(context).translate('device_list_v2.inverter')} | ${AppLocalizations.of(context).translate('device_list_v2.power')}',
|
||||
),
|
||||
@@ -162,6 +164,7 @@ class DeviceItemWidget extends StatelessWidget {
|
||||
dataItems.add(const SizedBox(width: 16));
|
||||
dataItems.add(
|
||||
_buildDataItem(
|
||||
context,
|
||||
'${device.todayEnergy}',
|
||||
'${AppLocalizations.of(context).translate('device_list_v2.today_energy')}',
|
||||
),
|
||||
@@ -170,6 +173,7 @@ class DeviceItemWidget extends StatelessWidget {
|
||||
if (device.current != null) {
|
||||
dataItems.add(
|
||||
_buildDataItem(
|
||||
context,
|
||||
'${device.current}',
|
||||
'${AppLocalizations.of(context).translate('device_list_v2.current')}',
|
||||
),
|
||||
@@ -179,6 +183,7 @@ class DeviceItemWidget extends StatelessWidget {
|
||||
if (device.temperature != null) {
|
||||
dataItems.add(
|
||||
_buildDataItem(
|
||||
context,
|
||||
'${device.temperature}',
|
||||
'${AppLocalizations.of(context).translate('device_list_v2.temperature')}',
|
||||
),
|
||||
@@ -187,6 +192,7 @@ class DeviceItemWidget extends StatelessWidget {
|
||||
} else if (device.type == 'module') {
|
||||
dataItems.add(
|
||||
_buildDataItem(
|
||||
context,
|
||||
'${device.power}',
|
||||
'${AppLocalizations.of(context).translate('device_list_v2.power')}',
|
||||
),
|
||||
@@ -195,6 +201,7 @@ class DeviceItemWidget extends StatelessWidget {
|
||||
if (device.radiation != null) {
|
||||
dataItems.add(
|
||||
_buildDataItem(
|
||||
context,
|
||||
'${device.radiation}',
|
||||
'${AppLocalizations.of(context).translate('device_list_v2.radiation')}',
|
||||
),
|
||||
@@ -203,6 +210,7 @@ class DeviceItemWidget extends StatelessWidget {
|
||||
} else {
|
||||
dataItems.add(
|
||||
_buildDataItem(
|
||||
context,
|
||||
'--',
|
||||
'${AppLocalizations.of(context).translate('device_list_v2.data')}',
|
||||
),
|
||||
@@ -212,22 +220,22 @@ class DeviceItemWidget extends StatelessWidget {
|
||||
return Row(children: dataItems);
|
||||
}
|
||||
|
||||
Widget _buildDataItem(String value, String unit) {
|
||||
Widget _buildDataItem(BuildContext context, String value, String unit) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
color: context.appColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
unit,
|
||||
style: const TextStyle(fontSize: 12, color: Color(0xFF4E5969)),
|
||||
style: TextStyle(fontSize: 12, color: context.appColors.textSecondary),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
|
||||
|
||||
import '../../domain/entities/drone_station_entity.dart';
|
||||
|
||||
@@ -23,12 +24,15 @@ class DroneStationItemCard extends StatelessWidget {
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
colors: [Colors.white, const Color(0xFFF8F9FA)],
|
||||
colors: [
|
||||
context.appColors.cardBackground,
|
||||
context.appColors.fillBackground,
|
||||
],
|
||||
),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.08),
|
||||
color: context.appColors.cardShadow,
|
||||
blurRadius: 12,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
@@ -43,8 +47,8 @@ class DroneStationItemCard extends StatelessWidget {
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
const Color(0xFF165DFF).withOpacity(0.05),
|
||||
const Color(0xFF165DFF).withOpacity(0.02),
|
||||
context.appColors.primary.withOpacity(0.05),
|
||||
context.appColors.primary.withOpacity(0.02),
|
||||
],
|
||||
),
|
||||
borderRadius: const BorderRadius.only(
|
||||
@@ -58,12 +62,12 @@ class DroneStationItemCard extends StatelessWidget {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF165DFF).withOpacity(0.1),
|
||||
color: context.appColors.primary.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: const Icon(
|
||||
child: Icon(
|
||||
Icons.home_max_rounded,
|
||||
color: Color(0xFF165DFF),
|
||||
color: context.appColors.primary,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
@@ -77,18 +81,18 @@ class DroneStationItemCard extends StatelessWidget {
|
||||
station.callsign.isNotEmpty
|
||||
? station.callsign
|
||||
: '未知机场',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 17,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
color: context.appColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
'SN: ${station.deviceSn}',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: Color(0xFF86909C),
|
||||
color: context.appColors.textTertiary,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -100,7 +104,7 @@ class DroneStationItemCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
|
||||
const Divider(height: 1, color: Color(0xFFE5E6EB)),
|
||||
Divider(height: 1, color: context.appColors.divider),
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
@@ -109,16 +113,19 @@ class DroneStationItemCard extends StatelessWidget {
|
||||
children: [
|
||||
// 机场基础信息卡片
|
||||
_buildSectionCard(
|
||||
context,
|
||||
title: '机场信息',
|
||||
icon: Icons.settings_rounded,
|
||||
children: [
|
||||
_buildInfoRowWithIcon(
|
||||
context,
|
||||
Icons.tag_rounded,
|
||||
'无人机序列号',
|
||||
station.deviceSn,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
_buildInfoRowWithIcon(
|
||||
context,
|
||||
Icons.router_rounded,
|
||||
'机场序列号',
|
||||
station.gatewaySn,
|
||||
@@ -335,7 +342,8 @@ class DroneStationItemCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// 区块卡片
|
||||
Widget _buildSectionCard({
|
||||
Widget _buildSectionCard(
|
||||
BuildContext context, {
|
||||
required String title,
|
||||
required IconData icon,
|
||||
required List<Widget> children,
|
||||
@@ -343,11 +351,11 @@ class DroneStationItemCard extends StatelessWidget {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: context.appColors.cardBackground,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.04),
|
||||
color: context.appColors.cardShadow,
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
@@ -358,14 +366,14 @@ class DroneStationItemCard extends StatelessWidget {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(icon, size: 18, color: const Color(0xFF165DFF)),
|
||||
Icon(icon, size: 18, color: context.appColors.primary),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Color(0xFF1D2129),
|
||||
color: context.appColors.textPrimary,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -378,25 +386,30 @@ class DroneStationItemCard extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// 信息行(带图标)
|
||||
Widget _buildInfoRowWithIcon(IconData icon, String label, String value) {
|
||||
Widget _buildInfoRowWithIcon(
|
||||
BuildContext context,
|
||||
IconData icon,
|
||||
String label,
|
||||
String value,
|
||||
) {
|
||||
return Row(
|
||||
children: [
|
||||
Icon(icon, size: 16, color: const Color(0xFF86909C)),
|
||||
Icon(icon, size: 16, color: context.appColors.textTertiary),
|
||||
const SizedBox(width: 8),
|
||||
SizedBox(
|
||||
width: 70,
|
||||
child: Text(
|
||||
'$label:',
|
||||
style: const TextStyle(fontSize: 11, color: Color(0xFF86909C)),
|
||||
style: TextStyle(fontSize: 11, color: context.appColors.textTertiary),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Expanded(
|
||||
child: Text(
|
||||
value,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF1D2129),
|
||||
color: context.appColors.textPrimary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
|
||||
|
||||
/// 底部操作按钮
|
||||
class RobotActionButtons extends StatelessWidget {
|
||||
@@ -13,7 +14,7 @@ class RobotActionButtons extends StatelessWidget {
|
||||
Expanded(
|
||||
child: _buildActionButton(
|
||||
label: '开始',
|
||||
color: const Color(0xFF165DFF),
|
||||
color: context.appColors.primary,
|
||||
onTap: () {},
|
||||
),
|
||||
),
|
||||
@@ -21,7 +22,7 @@ class RobotActionButtons extends StatelessWidget {
|
||||
Expanded(
|
||||
child: _buildActionButton(
|
||||
label: '暂停',
|
||||
color: const Color(0xFFFF7D00),
|
||||
color: context.appColors.warning,
|
||||
onTap: () {},
|
||||
),
|
||||
),
|
||||
@@ -29,9 +30,9 @@ class RobotActionButtons extends StatelessWidget {
|
||||
Expanded(
|
||||
child: _buildActionButton(
|
||||
label: '返航',
|
||||
color: Colors.white,
|
||||
borderColor: const Color(0xFFC9CDD4),
|
||||
textColor: const Color(0xFF4E5969),
|
||||
color: context.appColors.cardBackground,
|
||||
borderColor: context.appColors.textTertiary,
|
||||
textColor: context.appColors.textSecondary,
|
||||
onTap: () {},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
|
||||
|
||||
/// 检查清单
|
||||
class RobotChecklist extends StatelessWidget {
|
||||
@@ -11,39 +12,44 @@ class RobotChecklist extends StatelessWidget {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: context.appColors.cardBackground,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
color: context.appColors.cardShadow,
|
||||
blurRadius: 8,
|
||||
offset: Offset(0, 2),
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
Text(
|
||||
'检查清单',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
color: context.appColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
_buildCheckItem('逆变器', true),
|
||||
_buildCheckItem('汇流箱', true),
|
||||
_buildCheckItem('支架结构', true),
|
||||
_buildCheckItem('线缆通道', false, isWarning: true),
|
||||
_buildCheckItem('环境与杂物', false),
|
||||
_buildCheckItem(context, '逆变器', true),
|
||||
_buildCheckItem(context, '汇流箱', true),
|
||||
_buildCheckItem(context, '支架结构', true),
|
||||
_buildCheckItem(context, '线缆通道', false, isWarning: true),
|
||||
_buildCheckItem(context, '环境与杂物', false),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCheckItem(String label, bool isDone, {bool isWarning = false}) {
|
||||
Widget _buildCheckItem(
|
||||
BuildContext context,
|
||||
String label,
|
||||
bool isDone, {
|
||||
bool isWarning = false,
|
||||
}) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 6),
|
||||
child: Row(
|
||||
@@ -51,28 +57,28 @@ class RobotChecklist extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF1D2129),
|
||||
color: context.appColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (isDone)
|
||||
const Icon(
|
||||
Icon(
|
||||
Icons.check_circle,
|
||||
color: Color(0xFF00B42A),
|
||||
color: context.appColors.success,
|
||||
size: 20,
|
||||
)
|
||||
else if (isWarning)
|
||||
const Icon(
|
||||
Icon(
|
||||
Icons.error_outline,
|
||||
color: Color(0xFFFF7D00),
|
||||
color: context.appColors.warning,
|
||||
size: 20,
|
||||
)
|
||||
else
|
||||
const Icon(
|
||||
Icon(
|
||||
Icons.radio_button_unchecked,
|
||||
color: Color(0xFFC9CDD4),
|
||||
color: context.appColors.textTertiary,
|
||||
size: 20,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
|
||||
import '../../../../../../core/di/injection.dart';
|
||||
import '../../../../devices/presentation/bloc/devices_cubit.dart';
|
||||
import '../../../../devices/domain/entities/device_entity.dart';
|
||||
@@ -61,25 +62,25 @@ class RobotControlPanel extends StatelessWidget {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: context.appColors.cardBackground,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
color: context.appColors.cardShadow,
|
||||
blurRadius: 8,
|
||||
offset: Offset(0, 2),
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
Text(
|
||||
'控制面板',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
color: context.appColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
@@ -96,29 +97,29 @@ class RobotControlPanel extends StatelessWidget {
|
||||
width: 120,
|
||||
height: 120,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFFF5F6F8),
|
||||
color: context.appColors.fillBackground,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
),
|
||||
// 上
|
||||
Positioned(
|
||||
top: 8,
|
||||
child: _buildDirectionButton(Icons.arrow_upward, () {}),
|
||||
child: _buildDirectionButton(context, Icons.arrow_upward, () {}),
|
||||
),
|
||||
// 下
|
||||
Positioned(
|
||||
bottom: 8,
|
||||
child: _buildDirectionButton(Icons.arrow_downward, () {}),
|
||||
child: _buildDirectionButton(context, Icons.arrow_downward, () {}),
|
||||
),
|
||||
// 左
|
||||
Positioned(
|
||||
left: 8,
|
||||
child: _buildDirectionButton(Icons.arrow_back, () {}),
|
||||
child: _buildDirectionButton(context, Icons.arrow_back, () {}),
|
||||
),
|
||||
// 右
|
||||
Positioned(
|
||||
right: 8,
|
||||
child: _buildDirectionButton(Icons.arrow_forward, () {}),
|
||||
child: _buildDirectionButton(context, Icons.arrow_forward, () {}),
|
||||
),
|
||||
// 中心按钮
|
||||
Container(
|
||||
@@ -133,7 +134,7 @@ class RobotControlPanel extends StatelessWidget {
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: const Color(0xFF165DFF).withOpacity(0.3),
|
||||
color: context.appColors.primary.withOpacity(0.3),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
@@ -146,18 +147,18 @@ class RobotControlPanel extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
// 速度档位
|
||||
const Text(
|
||||
Text(
|
||||
'速度档位',
|
||||
style: TextStyle(fontSize: 13, color: Color(0xFF86909C)),
|
||||
style: TextStyle(fontSize: 13, color: context.appColors.textTertiary),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(child: _buildSpeedButton('低速', false, () {})),
|
||||
Expanded(child: _buildSpeedButton(context, '低速', false, () {})),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: _buildSpeedButton('中速', true, () {})),
|
||||
Expanded(child: _buildSpeedButton(context, '中速', true, () {})),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(child: _buildSpeedButton('高速', false, () {})),
|
||||
Expanded(child: _buildSpeedButton(context, '高速', false, () {})),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -166,35 +167,46 @@ class RobotControlPanel extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDirectionButton(IconData icon, VoidCallback onTap) {
|
||||
Widget _buildDirectionButton(
|
||||
BuildContext context,
|
||||
IconData icon,
|
||||
VoidCallback onTap,
|
||||
) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: context.appColors.cardBackground,
|
||||
shape: BoxShape.circle,
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
color: context.appColors.cardShadow,
|
||||
blurRadius: 4,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Icon(icon, color: const Color(0xFF1D2129), size: 20),
|
||||
child: Icon(icon, color: context.appColors.textPrimary, size: 20),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSpeedButton(String label, bool isSelected, VoidCallback onTap) {
|
||||
Widget _buildSpeedButton(
|
||||
BuildContext context,
|
||||
String label,
|
||||
bool isSelected,
|
||||
VoidCallback onTap,
|
||||
) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? const Color(0xFF165DFF) : const Color(0xFFF5F6F8),
|
||||
color: isSelected
|
||||
? context.appColors.primary
|
||||
: context.appColors.fillBackground,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Text(
|
||||
@@ -203,7 +215,9 @@ class RobotControlPanel extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isSelected ? Colors.white : const Color(0xFF4E5969),
|
||||
color: isSelected
|
||||
? Colors.white
|
||||
: context.appColors.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:maibu_satabot_v2/core/app/app_user_cubit.dart';
|
||||
import 'package:maibu_satabot_v2/core/app/app_user_state.dart'; // 🔥 导入 AppUserState
|
||||
import 'package:maibu_satabot_v2/core/consts/tcp_consts.dart';
|
||||
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
|
||||
import 'package:maibu_satabot_v2/features/remote_control/presentation/widgets/webrtc/webrtc_local_player.dart';
|
||||
import '../../../device_run_param/presentation/pages/robot_param_settings_page.dart';
|
||||
|
||||
@@ -91,13 +92,13 @@ class _RobotHeaderCardState extends State<RobotHeaderCard> {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: context.appColors.cardBackground,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
color: context.appColors.cardShadow,
|
||||
blurRadius: 8,
|
||||
offset: Offset(0, 2),
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -114,10 +115,10 @@ class _RobotHeaderCardState extends State<RobotHeaderCard> {
|
||||
(widget.robot['alias'] as String?)?.isNotEmpty == true
|
||||
? widget.robot['alias'] as String
|
||||
: '暂无别名',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
color: context.appColors.textPrimary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -125,9 +126,9 @@ class _RobotHeaderCardState extends State<RobotHeaderCard> {
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
widget.robot['name'] as String,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF86909C),
|
||||
color: context.appColors.textTertiary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -142,14 +143,14 @@ class _RobotHeaderCardState extends State<RobotHeaderCard> {
|
||||
Icon(
|
||||
Icons.signal_cellular_alt,
|
||||
size: 16,
|
||||
color: const Color(0xFF00B42A),
|
||||
color: context.appColors.success,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
const Text(
|
||||
Text(
|
||||
'强',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF00B42A),
|
||||
color: context.appColors.success,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
@@ -160,14 +161,14 @@ class _RobotHeaderCardState extends State<RobotHeaderCard> {
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF00B42A).withOpacity(0.1),
|
||||
color: context.appColors.success.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: const Text(
|
||||
child: Text(
|
||||
'在线',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF00B42A),
|
||||
color: context.appColors.success,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
@@ -184,10 +185,10 @@ class _RobotHeaderCardState extends State<RobotHeaderCard> {
|
||||
),
|
||||
);
|
||||
},
|
||||
child: const Icon(
|
||||
child: Icon(
|
||||
Icons.settings,
|
||||
size: 20,
|
||||
color: Color(0xFF86909C),
|
||||
color: context.appColors.textTertiary,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -264,11 +265,11 @@ class _RobotHeaderCardState extends State<RobotHeaderCard> {
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: isSelected
|
||||
? const Color(0xFF165DFF)
|
||||
: Colors.grey[200],
|
||||
? context.appColors.primary
|
||||
: context.appColors.fillBackground,
|
||||
foregroundColor: isSelected
|
||||
? Colors.white
|
||||
: Colors.grey[700],
|
||||
: context.appColors.textSecondary,
|
||||
elevation: 0,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 8,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
|
||||
|
||||
/// 机器人卡片组件
|
||||
class RobotItemCard extends StatelessWidget {
|
||||
@@ -32,13 +33,13 @@ class RobotItemCard extends StatelessWidget {
|
||||
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 6),
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: context.appColors.cardBackground,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
color: context.appColors.cardShadow,
|
||||
blurRadius: 8,
|
||||
offset: Offset(0, 2),
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -53,7 +54,7 @@ class RobotItemCard extends StatelessWidget {
|
||||
width: 48,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF165DFF).withOpacity(0.1),
|
||||
color: context.appColors.primary.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: ClipRRect(
|
||||
@@ -74,10 +75,10 @@ class RobotItemCard extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
alias != null && alias!.isNotEmpty ? alias! : '暂无别名',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
color: context.appColors.textPrimary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -85,9 +86,9 @@ class RobotItemCard extends StatelessWidget {
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
name, // 🔥 显示完整的长序列号 (deviceName)
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: Color(0xFF86909C),
|
||||
color: context.appColors.textTertiary,
|
||||
),
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
@@ -96,7 +97,7 @@ class RobotItemCard extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
// 状态标签
|
||||
_buildStatusTag(status),
|
||||
_buildStatusTag(context, status),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
@@ -118,10 +119,10 @@ class RobotItemCard extends StatelessWidget {
|
||||
: Icons.battery_alert,
|
||||
size: 16,
|
||||
color: battery > 50
|
||||
? const Color(0xFF00B42A)
|
||||
? context.appColors.success
|
||||
: battery > 20
|
||||
? const Color(0xFFFF7D00)
|
||||
: const Color(0xFFF53F3F),
|
||||
? context.appColors.warning
|
||||
: context.appColors.danger,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
@@ -130,10 +131,10 @@ class RobotItemCard extends StatelessWidget {
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: battery > 50
|
||||
? const Color(0xFF00B42A)
|
||||
? context.appColors.success
|
||||
: battery > 20
|
||||
? const Color(0xFFFF7D00)
|
||||
: const Color(0xFFF53F3F),
|
||||
? context.appColors.warning
|
||||
: context.appColors.danger,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -145,7 +146,7 @@ class RobotItemCard extends StatelessWidget {
|
||||
).translate('device_list_v2.battery_level'),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF4E5969),
|
||||
color: context.appColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -158,10 +159,10 @@ class RobotItemCard extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
task,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF1D2129),
|
||||
color: context.appColors.textPrimary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -173,7 +174,7 @@ class RobotItemCard extends StatelessWidget {
|
||||
).translate('device_list_v2.current_task'),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF4E5969),
|
||||
color: context.appColors.textSecondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -187,18 +188,18 @@ class RobotItemCard extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusTag(String status) {
|
||||
Widget _buildStatusTag(BuildContext context, String status) {
|
||||
Color bgColor;
|
||||
Color textColor;
|
||||
|
||||
switch (status) {
|
||||
case '在线':
|
||||
bgColor = const Color(0xFFF0F9FF);
|
||||
textColor = const Color(0xFF00B42A);
|
||||
bgColor = context.appColors.success.withOpacity(0.1);
|
||||
textColor = context.appColors.success;
|
||||
break;
|
||||
default:
|
||||
bgColor = const Color(0xFFF5F0FF);
|
||||
textColor = const Color(0xFFF53F3F);
|
||||
bgColor = context.appColors.danger.withOpacity(0.1);
|
||||
textColor = context.appColors.danger;
|
||||
}
|
||||
|
||||
return Container(
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
|
||||
import '../../../../../components/device_status_modal.dart';
|
||||
import '../../../../devices/presentation/bloc/device_status_bloc.dart';
|
||||
import '../../../../devices/presentation/bloc/device_status_state.dart';
|
||||
@@ -49,8 +50,8 @@ class RobotStatusBar extends StatelessWidget {
|
||||
String mode = '--';
|
||||
String battery = '--';
|
||||
String signal = '--';
|
||||
Color signalColor = const Color(0xFF86909C);
|
||||
Color batteryColor = const Color(0xFF86909C);
|
||||
Color signalColor = context.appColors.textTertiary;
|
||||
Color batteryColor = context.appColors.textTertiary;
|
||||
|
||||
if (state is DeviceStatusUpdated) {
|
||||
final s = state.status;
|
||||
@@ -61,38 +62,38 @@ class RobotStatusBar extends StatelessWidget {
|
||||
final qual = s.qual;
|
||||
if (qual >= 4) {
|
||||
signal = '强';
|
||||
signalColor = const Color(0xFF00B42A);
|
||||
signalColor = context.appColors.success;
|
||||
} else if (qual >= 2) {
|
||||
signal = '中';
|
||||
signalColor = const Color(0xFFFF7D00);
|
||||
signalColor = context.appColors.warning;
|
||||
} else if (qual >= 1) {
|
||||
signal = '弱';
|
||||
signalColor = const Color(0xFFF53F3F);
|
||||
signalColor = context.appColors.danger;
|
||||
} else {
|
||||
signal = '无';
|
||||
signalColor = const Color(0xFF86909C);
|
||||
signalColor = context.appColors.textTertiary;
|
||||
}
|
||||
|
||||
final batValue = int.tryParse(battery) ?? 0;
|
||||
if (batValue > 50) {
|
||||
batteryColor = const Color(0xFF00B42A);
|
||||
batteryColor = context.appColors.success;
|
||||
} else if (batValue > 20) {
|
||||
batteryColor = const Color(0xFFFF7D00);
|
||||
batteryColor = context.appColors.warning;
|
||||
} else if (batValue > 0) {
|
||||
batteryColor = const Color(0xFFF53F3F);
|
||||
batteryColor = context.appColors.danger;
|
||||
}
|
||||
}
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: context.appColors.cardBackground,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
color: context.appColors.cardShadow,
|
||||
blurRadius: 8,
|
||||
offset: Offset(0, 2),
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -102,25 +103,29 @@ class RobotStatusBar extends StatelessWidget {
|
||||
child: Row(
|
||||
children: [
|
||||
_buildStatusItem(
|
||||
context,
|
||||
label: '转速',
|
||||
value: speed,
|
||||
unit: 'rpm',
|
||||
),
|
||||
Container(width: 1, height: 40, color: const Color(0xFFE5E6EB)),
|
||||
Container(width: 1, height: 40, color: context.appColors.divider),
|
||||
_buildStatusItem(
|
||||
context,
|
||||
label: '模式',
|
||||
value: mode,
|
||||
unit: '',
|
||||
),
|
||||
Container(width: 1, height: 40, color: const Color(0xFFE5E6EB)),
|
||||
Container(width: 1, height: 40, color: context.appColors.divider),
|
||||
_buildStatusItem(
|
||||
context,
|
||||
label: '电量',
|
||||
value: battery,
|
||||
unit: '%',
|
||||
valueColor: batteryColor,
|
||||
),
|
||||
Container(width: 1, height: 40, color: const Color(0xFFE5E6EB)),
|
||||
Container(width: 1, height: 40, color: context.appColors.divider),
|
||||
_buildStatusItem(
|
||||
context,
|
||||
label: '信号',
|
||||
value: signal,
|
||||
unit: '',
|
||||
@@ -130,10 +135,10 @@ class RobotStatusBar extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
const Icon(
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 16,
|
||||
color: Color(0xFF86909C),
|
||||
color: context.appColors.textTertiary,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -143,7 +148,8 @@ class RobotStatusBar extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildStatusItem({
|
||||
Widget _buildStatusItem(
|
||||
BuildContext context, {
|
||||
required String label,
|
||||
required String value,
|
||||
required String unit,
|
||||
@@ -154,9 +160,9 @@ class RobotStatusBar extends StatelessWidget {
|
||||
children: [
|
||||
Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: Color(0xFF86909C),
|
||||
color: context.appColors.textTertiary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
@@ -169,7 +175,7 @@ class RobotStatusBar extends StatelessWidget {
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: valueColor ?? const Color(0xFF1D2129),
|
||||
color: valueColor ?? context.appColors.textPrimary,
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
@@ -180,7 +186,7 @@ class RobotStatusBar extends StatelessWidget {
|
||||
unit,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: valueColor ?? const Color(0xFF1D2129),
|
||||
color: valueColor ?? context.appColors.textPrimary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
|
||||
|
||||
/// 当前任务信息
|
||||
class RobotTaskInfo extends StatelessWidget {
|
||||
@@ -11,25 +12,25 @@ class RobotTaskInfo extends StatelessWidget {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
color: context.appColors.cardBackground,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: const [
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Color(0x0D000000),
|
||||
color: context.appColors.cardShadow,
|
||||
blurRadius: 8,
|
||||
offset: Offset(0, 2),
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
Text(
|
||||
'当前任务',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
color: context.appColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
@@ -38,24 +39,24 @@ class RobotTaskInfo extends StatelessWidget {
|
||||
Expanded(
|
||||
child: Text(
|
||||
robot['task'] ?? '逆变器区巡检',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Color(0xFF1D2129),
|
||||
color: context.appColors.textPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF165DFF).withOpacity(0.1),
|
||||
color: context.appColors.primary.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: const Text(
|
||||
child: Text(
|
||||
'进行中',
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
color: Color(0xFF165DFF),
|
||||
color: context.appColors.primary,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user