1.优化补足了首页下拉刷新中对获取场站接口的加入,确保能够实时获取数据并渲染。
2.优化修改了tcp重连机制,具体操作:断开重连时候不再建立新链接 而是将旧链接重置,并重新发送数据。 3.大面积的给项目中的各个页面 手动接入了多语言的支持。同时也调整了相应带来的问题英文长度较大影响原有的样式的问题,已解决了对应的样式不和谐问题。保证了外观的统一性。 4.给项目中的主要操作加了几个核心的操作比如远程遥控和路径规划添加了双层的保护,设置里安全模式,即在此期间对服务器推送的重复登录操作后的自动退出登录做一个拦截 保证操作的安全性。
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/waring_center/presentation/bloc/alarm_cubit.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/waring_center/presentation/bloc/alarm_state.dart';
|
||||
import 'package:maibu_satabot_v2/features/v2/waring_center/presentation/constants/alarm_constants.dart';
|
||||
@@ -44,9 +45,7 @@ class _AlarmCenterPageState extends State<AlarmCenterPage> {
|
||||
child: BlocBuilder<AlarmCubit, AlarmState>(
|
||||
builder: (context, state) {
|
||||
if (state is AlarmLoading) {
|
||||
return const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
);
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
|
||||
if (state is AlarmError) {
|
||||
@@ -64,7 +63,11 @@ class _AlarmCenterPageState extends State<AlarmCenterPage> {
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton(
|
||||
onPressed: () => _cubit.loadAlarms(),
|
||||
child: const Text('重试'),
|
||||
child: Text(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('alarm_center.retry'),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -96,22 +99,34 @@ class _AlarmCenterPageState extends State<AlarmCenterPage> {
|
||||
//const SizedBox(height: AlarmDimensions.moduleSpacing),
|
||||
// 告警统计卡片
|
||||
AlarmCountCard(count: state.count),
|
||||
const SizedBox(height: AlarmDimensions.moduleSpacing),
|
||||
const SizedBox(
|
||||
height: AlarmDimensions.moduleSpacing,
|
||||
),
|
||||
// 告警列表
|
||||
...state.alarms.map((alarm) {
|
||||
return AlarmItemCard(
|
||||
alarm: alarm,
|
||||
onTap: () {
|
||||
context.push('/alarm_center/detail/${alarm.id}');
|
||||
context.push(
|
||||
'/alarm_center/detail/${alarm.id}',
|
||||
);
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
const SizedBox(height: AlarmDimensions.moduleSpacing),
|
||||
const SizedBox(
|
||||
height: AlarmDimensions.moduleSpacing,
|
||||
),
|
||||
// AI 诊断建议(仅当有 AI 诊断内容时显示)
|
||||
if (state.alarms.any((alarm) => alarm.aiDiagnosis != null))
|
||||
if (state.alarms.any(
|
||||
(alarm) => alarm.aiDiagnosis != null,
|
||||
))
|
||||
AiDiagnosisCard(
|
||||
content: state.alarms
|
||||
.firstWhere((alarm) => alarm.aiDiagnosis != null)
|
||||
content:
|
||||
state.alarms
|
||||
.firstWhere(
|
||||
(alarm) =>
|
||||
alarm.aiDiagnosis != null,
|
||||
)
|
||||
.aiDiagnosis ??
|
||||
'',
|
||||
onViewDetails: () {
|
||||
@@ -153,20 +168,61 @@ class _AlarmCenterPageState extends State<AlarmCenterPage> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Text(
|
||||
'筛选条件',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('alarm_center.filter_title'),
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: AlarmColors.textPrimary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildFilterOption('告警等级', ['高危', '中危', '低危', '提示']),
|
||||
_buildFilterOption(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('alarm_center.alarm_level'),
|
||||
[
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('alarm_center.high_risk'),
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('alarm_center.medium_risk'),
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('alarm_center.low_risk'),
|
||||
AppLocalizations.of(context).translate('alarm_center.hint'),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildFilterOption('时间范围', ['今天', '本周', '本月', '全部']),
|
||||
_buildFilterOption(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('alarm_center.time_range'),
|
||||
[
|
||||
AppLocalizations.of(context).translate('alarm_center.today'),
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('alarm_center.this_week'),
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('alarm_center.this_month'),
|
||||
AppLocalizations.of(context).translate('alarm_center.all'),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildFilterOption('区域', ['A区', 'B区', 'C区', 'D区', '全部']),
|
||||
_buildFilterOption(
|
||||
AppLocalizations.of(context).translate('alarm_center.area'),
|
||||
[
|
||||
'A区',
|
||||
'B区',
|
||||
'C区',
|
||||
'D区',
|
||||
AppLocalizations.of(context).translate('alarm_center.all'),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
@@ -181,9 +237,11 @@ class _AlarmCenterPageState extends State<AlarmCenterPage> {
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'应用筛选',
|
||||
style: TextStyle(
|
||||
child: Text(
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
).translate('alarm_center.apply_filter'),
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
@@ -204,9 +262,9 @@ class _AlarmCenterPageState extends State<AlarmCenterPage> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Row(
|
||||
children: [
|
||||
const Text(
|
||||
'告警中心',
|
||||
style: TextStyle(
|
||||
Text(
|
||||
AppLocalizations.of(context).translate('alarm_center.title'),
|
||||
style: const TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color(0xFF1D2129),
|
||||
|
||||
Reference in New Issue
Block a user