1.优化补足了首页下拉刷新中对获取场站接口的加入,确保能够实时获取数据并渲染。
2.优化修改了tcp重连机制,具体操作:断开重连时候不再建立新链接 而是将旧链接重置,并重新发送数据。 3.大面积的给项目中的各个页面 手动接入了多语言的支持。同时也调整了相应带来的问题英文长度较大影响原有的样式的问题,已解决了对应的样式不和谐问题。保证了外观的统一性。 4.给项目中的主要操作加了几个核心的操作比如远程遥控和路径规划添加了双层的保护,设置里安全模式,即在此期间对服务器推送的重复登录操作后的自动退出登录做一个拦截 保证操作的安全性。
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import '../constants/report_constants.dart';
|
||||
|
||||
/// 问题描述输入模块
|
||||
@@ -14,6 +15,7 @@ class DescriptionInput extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: AppDimensions.horizontalPadding,
|
||||
@@ -34,8 +36,8 @@ class DescriptionInput extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'问题描述',
|
||||
style: TextStyle(
|
||||
loc.translate('report.problem_description'),
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
@@ -47,35 +49,38 @@ class DescriptionInput extends StatelessWidget {
|
||||
maxLength: 200,
|
||||
onChanged: onChanged,
|
||||
decoration: InputDecoration(
|
||||
hintText: '请详细描述问题现象...',
|
||||
hintStyle: TextStyle(color: AppColors.textHint),
|
||||
hintText: loc.translate('report.description_hint'),
|
||||
hintStyle: const TextStyle(color: AppColors.textHint),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(AppDimensions.borderRadiusSmall),
|
||||
borderSide: BorderSide(color: AppColors.borderColor),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppDimensions.borderRadiusSmall,
|
||||
),
|
||||
borderSide: const BorderSide(color: AppColors.borderColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(AppDimensions.borderRadiusSmall),
|
||||
borderSide: BorderSide(color: AppColors.borderColor),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppDimensions.borderRadiusSmall,
|
||||
),
|
||||
borderSide: const BorderSide(color: AppColors.borderColor),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(AppDimensions.borderRadiusSmall),
|
||||
borderSide: BorderSide(color: AppColors.primary, width: 2),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppDimensions.borderRadiusSmall,
|
||||
),
|
||||
borderSide: const BorderSide(
|
||||
color: AppColors.primary,
|
||||
width: 2,
|
||||
),
|
||||
),
|
||||
counterText: '',
|
||||
),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
style: const TextStyle(fontSize: 14, color: AppColors.textPrimary),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
'${description?.length ?? 0}/200',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppColors.textHint,
|
||||
),
|
||||
style: const TextStyle(fontSize: 12, color: AppColors.textHint),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import '../constants/report_constants.dart';
|
||||
|
||||
/// 设备选择器
|
||||
@@ -6,11 +7,7 @@ class DeviceSelector extends StatelessWidget {
|
||||
final String? selectedDevice;
|
||||
final VoidCallback onTap;
|
||||
|
||||
const DeviceSelector({
|
||||
super.key,
|
||||
this.selectedDevice,
|
||||
required this.onTap,
|
||||
});
|
||||
const DeviceSelector({super.key, this.selectedDevice, required this.onTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -36,8 +33,8 @@ class DeviceSelector extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'设备选择',
|
||||
style: TextStyle(
|
||||
AppLocalizations.of(context).translate('report.select_device'),
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
@@ -46,7 +43,10 @@ class DeviceSelector extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
selectedDevice ?? '请选择设备',
|
||||
selectedDevice ??
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('report.please_select_device'),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: selectedDevice != null
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import '../constants/report_constants.dart';
|
||||
|
||||
/// 问题等级选择器
|
||||
@@ -14,6 +15,7 @@ class LevelSelector extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: AppDimensions.horizontalPadding,
|
||||
@@ -34,8 +36,8 @@ class LevelSelector extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'问题等级',
|
||||
style: TextStyle(
|
||||
loc.translate('report.problem_level'),
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
@@ -55,19 +57,27 @@ class LevelSelector extends StatelessWidget {
|
||||
color: isSelected && level == ProblemLevel.urgent
|
||||
? AppColors.danger.withOpacity(0.1)
|
||||
: AppColors.background,
|
||||
borderRadius: BorderRadius.circular(AppDimensions.borderRadiusSmall),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppDimensions.borderRadiusSmall,
|
||||
),
|
||||
border: Border.all(
|
||||
color: isSelected ? level.borderColor : AppColors.borderColor,
|
||||
color: isSelected
|
||||
? level.borderColor
|
||||
: AppColors.borderColor,
|
||||
width: isSelected ? 2 : 1,
|
||||
),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
level.label,
|
||||
loc.translate(level.labelKey),
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: isSelected ? level.textColor : level.textColor.withOpacity(0.6),
|
||||
fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal,
|
||||
color: isSelected
|
||||
? level.textColor
|
||||
: level.textColor.withOpacity(0.6),
|
||||
fontWeight: isSelected
|
||||
? FontWeight.w600
|
||||
: FontWeight.normal,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import '../constants/report_constants.dart';
|
||||
|
||||
/// 媒体上传模块
|
||||
@@ -23,6 +24,7 @@ class MediaUploader extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: AppDimensions.horizontalPadding,
|
||||
@@ -43,8 +45,8 @@ class MediaUploader extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'上传图片/视频',
|
||||
style: TextStyle(
|
||||
loc.translate('report.upload_media'),
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
@@ -58,14 +60,14 @@ class MediaUploader extends StatelessWidget {
|
||||
// 拍照按钮
|
||||
_buildUploadButton(
|
||||
icon: Icons.camera_alt,
|
||||
label: '拍照',
|
||||
label: loc.translate('report.take_photo'),
|
||||
onTap: onCameraTap,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
// 录像按钮
|
||||
_buildUploadButton(
|
||||
icon: Icons.videocam,
|
||||
label: '录像',
|
||||
label: loc.translate('report.record_video'),
|
||||
onTap: onVideoTap,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
@@ -74,84 +76,94 @@ class MediaUploader extends StatelessWidget {
|
||||
final String filePath = entry.value;
|
||||
final bool isNetworkImage = filePath.startsWith('http');
|
||||
final bool isVideo = _isVideoFile(filePath);
|
||||
|
||||
|
||||
return GestureDetector(
|
||||
onTap: () => onTap?.call(entry.key),
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
margin: const EdgeInsets.only(right: 8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(AppDimensions.borderRadiusSmall),
|
||||
color: AppColors.cardBackground,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(AppDimensions.borderRadiusSmall),
|
||||
child: isVideo
|
||||
? _buildVideoThumbnail(filePath)
|
||||
: (isNetworkImage
|
||||
? Image.network(
|
||||
filePath,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return _buildPlaceholderIcon(Icons.broken_image);
|
||||
},
|
||||
)
|
||||
: Image.file(
|
||||
File(filePath),
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return _buildPlaceholderIcon(Icons.broken_image);
|
||||
},
|
||||
)),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 4,
|
||||
right: 12,
|
||||
child: GestureDetector(
|
||||
onTap: () => onRemove(entry.key),
|
||||
child: Container(
|
||||
width: 20,
|
||||
height: 20,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.black54,
|
||||
shape: BoxShape.circle,
|
||||
children: [
|
||||
Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
margin: const EdgeInsets.only(right: 8),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppDimensions.borderRadiusSmall,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.close,
|
||||
size: 14,
|
||||
color: Colors.white,
|
||||
color: AppColors.cardBackground,
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppDimensions.borderRadiusSmall,
|
||||
),
|
||||
child: isVideo
|
||||
? _buildVideoThumbnail(filePath)
|
||||
: (isNetworkImage
|
||||
? Image.network(
|
||||
filePath,
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder:
|
||||
(context, error, stackTrace) {
|
||||
return _buildPlaceholderIcon(
|
||||
Icons.broken_image,
|
||||
);
|
||||
},
|
||||
)
|
||||
: Image.file(
|
||||
File(filePath),
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder:
|
||||
(context, error, stackTrace) {
|
||||
return _buildPlaceholderIcon(
|
||||
Icons.broken_image,
|
||||
);
|
||||
},
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
// 视频播放图标
|
||||
if (isVideo)
|
||||
Positioned(
|
||||
child: Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
margin: const EdgeInsets.only(right: 8),
|
||||
alignment: Alignment.center,
|
||||
top: 4,
|
||||
right: 12,
|
||||
child: GestureDetector(
|
||||
onTap: () => onRemove(entry.key),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
width: 20,
|
||||
height: 20,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.black38,
|
||||
color: Colors.black54,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.play_arrow,
|
||||
Icons.close,
|
||||
size: 14,
|
||||
color: Colors.white,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// 视频播放图标
|
||||
if (isVideo)
|
||||
Positioned(
|
||||
child: Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
margin: const EdgeInsets.only(right: 8),
|
||||
alignment: Alignment.center,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.black38,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.play_arrow,
|
||||
color: Colors.white,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
// 添加按钮
|
||||
@@ -228,17 +240,9 @@ class MediaUploader extends StatelessWidget {
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
// 灰色背景
|
||||
Container(
|
||||
color: Colors.grey[300],
|
||||
),
|
||||
Container(color: Colors.grey[300]),
|
||||
// 视频图标
|
||||
const Center(
|
||||
child: Icon(
|
||||
Icons.videocam,
|
||||
color: Colors.grey,
|
||||
size: 32,
|
||||
),
|
||||
),
|
||||
const Center(child: Icon(Icons.videocam, color: Colors.grey, size: 32)),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -247,13 +251,7 @@ class MediaUploader extends StatelessWidget {
|
||||
Widget _buildPlaceholderIcon(IconData icon) {
|
||||
return Container(
|
||||
color: Colors.grey[300],
|
||||
child: Center(
|
||||
child: Icon(
|
||||
icon,
|
||||
color: Colors.grey,
|
||||
size: 32,
|
||||
),
|
||||
),
|
||||
child: Center(child: Icon(icon, color: Colors.grey, size: 32)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import '../constants/report_constants.dart';
|
||||
|
||||
/// 上报类型选择器
|
||||
@@ -15,21 +16,32 @@ class ReportTypeSelector extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: AppDimensions.horizontalPadding),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: AppDimensions.horizontalPadding,
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: ReportType.values.map((type) {
|
||||
final isSelected = selectedType == type;
|
||||
return Expanded(
|
||||
return Flexible(
|
||||
flex: 1,
|
||||
child: GestureDetector(
|
||||
onTap: () => onSelected(type),
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 4),
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
margin: const EdgeInsets.symmetric(horizontal: 3),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 8,
|
||||
vertical: 14,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.background,
|
||||
borderRadius: BorderRadius.circular(AppDimensions.borderRadiusSmall),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppDimensions.borderRadiusSmall,
|
||||
),
|
||||
border: Border.all(
|
||||
color: isSelected ? AppColors.primary : AppColors.borderColor,
|
||||
color: isSelected
|
||||
? AppColors.primary
|
||||
: AppColors.borderColor,
|
||||
width: isSelected ? 2 : 1,
|
||||
),
|
||||
boxShadow: [
|
||||
@@ -45,17 +57,27 @@ class ReportTypeSelector extends StatelessWidget {
|
||||
children: [
|
||||
Icon(
|
||||
type.icon,
|
||||
color: isSelected ? AppColors.primary : AppColors.textHint,
|
||||
size: 24,
|
||||
color: isSelected
|
||||
? AppColors.primary
|
||||
: AppColors.textHint,
|
||||
size: 26,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
type.label,
|
||||
AppLocalizations.of(context).translate(type.labelKey),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: isSelected ? AppColors.primary : AppColors.textSecondary,
|
||||
fontWeight: isSelected ? FontWeight.w600 : FontWeight.normal,
|
||||
fontSize: 11,
|
||||
height: 1.2,
|
||||
color: isSelected
|
||||
? AppColors.primary
|
||||
: AppColors.textSecondary,
|
||||
fontWeight: isSelected
|
||||
? FontWeight.w600
|
||||
: FontWeight.normal,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user