1.优化补足了首页下拉刷新中对获取场站接口的加入,确保能够实时获取数据并渲染。
2.优化修改了tcp重连机制,具体操作:断开重连时候不再建立新链接 而是将旧链接重置,并重新发送数据。 3.大面积的给项目中的各个页面 手动接入了多语言的支持。同时也调整了相应带来的问题英文长度较大影响原有的样式的问题,已解决了对应的样式不和谐问题。保证了外观的统一性。 4.给项目中的主要操作加了几个核心的操作比如远程遥控和路径规划添加了双层的保护,设置里安全模式,即在此期间对服务器推送的重复登录操作后的自动退出登录做一个拦截 保证操作的安全性。
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import '../cubit/report_cubit.dart';
|
||||
import '../states/report_state.dart';
|
||||
import '../constants/report_constants.dart';
|
||||
@@ -46,9 +47,7 @@ class _ReportPageContent extends StatelessWidget {
|
||||
builder: (context, state) {
|
||||
if (state is ReportSubmitting) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: AppColors.primary,
|
||||
),
|
||||
child: CircularProgressIndicator(color: AppColors.primary),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -57,9 +56,7 @@ class _ReportPageContent extends StatelessWidget {
|
||||
return Column(
|
||||
children: [
|
||||
_buildAppBar(context, state.location, cubit),
|
||||
Expanded(
|
||||
child: _buildFormContent(context, state),
|
||||
),
|
||||
Expanded(child: _buildFormContent(context, state)),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -72,7 +69,11 @@ class _ReportPageContent extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// 构建导航栏
|
||||
PreferredSizeWidget _buildAppBar(BuildContext context, String location, ReportCubit cubit) {
|
||||
PreferredSizeWidget _buildAppBar(
|
||||
BuildContext context,
|
||||
String location,
|
||||
ReportCubit cubit,
|
||||
) {
|
||||
return PreferredSize(
|
||||
preferredSize: const Size.fromHeight(100),
|
||||
child: Container(
|
||||
@@ -89,9 +90,9 @@ class _ReportPageContent extends StatelessWidget {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
const Text(
|
||||
'现场上报',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
AppLocalizations.of(context).translate('report.title'),
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AppColors.textPrimary,
|
||||
@@ -101,9 +102,9 @@ class _ReportPageContent extends StatelessWidget {
|
||||
onTap: () {
|
||||
context.read<ReportCubit>().submitReport();
|
||||
},
|
||||
child: const Text(
|
||||
'提交',
|
||||
style: TextStyle(
|
||||
child: Text(
|
||||
AppLocalizations.of(context).translate('report.submit'),
|
||||
style: const TextStyle(
|
||||
color: AppColors.primary,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -240,19 +241,12 @@ class _ReportPageContent extends StatelessWidget {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.location_on,
|
||||
color: AppColors.primary,
|
||||
size: 20,
|
||||
),
|
||||
const Icon(Icons.location_on, color: AppColors.primary, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
location,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
style: TextStyle(fontSize: 16, color: AppColors.textPrimary),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -270,7 +264,7 @@ class _ReportPageContent extends StatelessWidget {
|
||||
maxHeight: 1080,
|
||||
imageQuality: 85,
|
||||
);
|
||||
|
||||
|
||||
if (image != null) {
|
||||
cubit.addMediaFile(image.path);
|
||||
}
|
||||
@@ -287,7 +281,7 @@ class _ReportPageContent extends StatelessWidget {
|
||||
source: ImageSource.camera,
|
||||
maxDuration: const Duration(minutes: 5),
|
||||
);
|
||||
|
||||
|
||||
if (video != null) {
|
||||
cubit.addMediaFile(video.path);
|
||||
}
|
||||
@@ -301,10 +295,8 @@ class _ReportPageContent extends StatelessWidget {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => MediaPreviewPage(
|
||||
mediaFiles: mediaFiles,
|
||||
initialIndex: index,
|
||||
),
|
||||
builder: (context) =>
|
||||
MediaPreviewPage(mediaFiles: mediaFiles, initialIndex: index),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -322,7 +314,9 @@ class _ReportPageContent extends StatelessWidget {
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.image),
|
||||
title: const Text('选择图片'),
|
||||
title: Text(
|
||||
AppLocalizations.of(context).translate('report.select_image'),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(context);
|
||||
final XFile? image = await picker.pickImage(
|
||||
@@ -338,7 +332,9 @@ class _ReportPageContent extends StatelessWidget {
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.video_library),
|
||||
title: const Text('选择视频'),
|
||||
title: Text(
|
||||
AppLocalizations.of(context).translate('report.select_video'),
|
||||
),
|
||||
onTap: () async {
|
||||
Navigator.pop(context);
|
||||
final XFile? video = await picker.pickVideo(
|
||||
@@ -360,19 +356,20 @@ class _ReportPageContent extends StatelessWidget {
|
||||
|
||||
/// 显示位置选择器
|
||||
void _showLocationPicker(BuildContext context, ReportCubit cubit) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
final locations = [
|
||||
'主厂房A区',
|
||||
'主厂房B区',
|
||||
'锅炉房',
|
||||
'汽机房',
|
||||
'控制室',
|
||||
'配电室',
|
||||
loc.translate('report.main_building_a'),
|
||||
loc.translate('report.main_building_b'),
|
||||
loc.translate('report.boiler_room'),
|
||||
loc.translate('report.turbine_room'),
|
||||
loc.translate('report.control_room'),
|
||||
loc.translate('report.power_distribution_room'),
|
||||
];
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('选择位置'),
|
||||
title: Text(loc.translate('report.select_location')),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -390,7 +387,7 @@ class _ReportPageContent extends StatelessWidget {
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('取消'),
|
||||
child: Text(loc.translate('report.cancel')),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -399,19 +396,20 @@ class _ReportPageContent extends StatelessWidget {
|
||||
|
||||
/// 显示设备选择器
|
||||
void _showDevicePicker(BuildContext context, ReportCubit cubit) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
final devices = [
|
||||
'锅炉1号',
|
||||
'锅炉2号',
|
||||
'汽轮机1号',
|
||||
'发电机1号',
|
||||
'变压器1号',
|
||||
'水泵1号',
|
||||
loc.translate('report.boiler_1'),
|
||||
loc.translate('report.boiler_2'),
|
||||
loc.translate('report.turbine_1'),
|
||||
loc.translate('report.generator_1'),
|
||||
loc.translate('report.transformer_1'),
|
||||
loc.translate('report.water_pump_1'),
|
||||
];
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('选择设备'),
|
||||
title: Text(loc.translate('report.select_device')),
|
||||
content: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -429,7 +427,7 @@ class _ReportPageContent extends StatelessWidget {
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('取消'),
|
||||
child: Text(loc.translate('report.cancel')),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -438,19 +436,20 @@ class _ReportPageContent extends StatelessWidget {
|
||||
|
||||
/// 显示成功对话框
|
||||
void _showSuccessDialog(BuildContext context) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('提交成功'),
|
||||
content: const Text('您的上报已成功提交'),
|
||||
title: Text(loc.translate('report.submit_success')),
|
||||
content: Text(loc.translate('report.submit_success_message')),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.pop(context); // 返回上一页
|
||||
},
|
||||
child: const Text('确定'),
|
||||
child: Text(loc.translate('report.confirm')),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -459,15 +458,16 @@ class _ReportPageContent extends StatelessWidget {
|
||||
|
||||
/// 显示错误对话框
|
||||
void _showErrorDialog(BuildContext context, String message) {
|
||||
final loc = AppLocalizations.of(context);
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('提交失败'),
|
||||
title: Text(loc.translate('report.submit_failed')),
|
||||
content: Text(message),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('确定'),
|
||||
child: Text(loc.translate('report.confirm')),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user