对接路径规划的列表(根据场站的下的)

优化无人机机场的监控视频的显示视频流畅度提升80%
添加首页tcp指示灯的机器状态信息展示功能。(暂不支持在此页面上设备的切换显示)
This commit is contained in:
2026-06-09 14:39:55 +08:00
parent ff4a3836c7
commit 058a5d9588
26 changed files with 3634 additions and 1028 deletions

View File

@@ -12,6 +12,8 @@ import 'package:maibu_satabot_v2/features/v2/home/presentation/widgets/quick_ent
import 'package:maibu_satabot_v2/features/v2/home/presentation/widgets/power_trend_chart.dart';
import 'package:maibu_satabot_v2/features/v2/home/presentation/widgets/plant_overview_card.dart';
import 'package:maibu_satabot_v2/features/v2/home/presentation/widgets/tcp_status_indicator.dart';
import 'package:maibu_satabot_v2/components/device_status_modal.dart';
import 'package:maibu_satabot_v2/features/devices/presentation/bloc/device_status_bloc.dart';
class HomeV2Page extends StatefulWidget {
const HomeV2Page({super.key});
@@ -40,7 +42,11 @@ class _HomeV2PageState extends State<HomeV2Page> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(Icons.error_outline, size: 48, color: Color(0xFF86909C)),
const Icon(
Icons.error_outline,
size: 48,
color: Color(0xFF86909C),
),
const SizedBox(height: 16),
Text(state.message),
const SizedBox(height: 16),
@@ -81,9 +87,12 @@ class _HomeV2PageState extends State<HomeV2Page> {
child: StreamBuilder<SiteState>(
stream: sl<SiteCubit>().stream,
builder: (context, snapshot) {
final siteState = snapshot.data ?? sl<SiteCubit>().state;
final siteState =
snapshot.data ??
sl<SiteCubit>().state;
return Text(
siteState.selectedSite?.siteName ?? '选择电站',
siteState.selectedSite?.siteName ??
'选择电站',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: const TextStyle(
@@ -96,12 +105,18 @@ class _HomeV2PageState extends State<HomeV2Page> {
),
),
const SizedBox(width: 4),
const Icon(Icons.arrow_drop_down, size: 20, color: Color(0xFF1D2129)),
const Icon(
Icons.arrow_drop_down,
size: 20,
color: Color(0xFF1D2129),
),
],
),
),
),
const TcpStatusIndicator(),
TcpStatusIndicator(
onTap: () => _showDeviceStatusModal(context),
),
],
),
),
@@ -117,7 +132,10 @@ class _HomeV2PageState extends State<HomeV2Page> {
children: [
Expanded(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 8,
),
decoration: BoxDecoration(
color: const Color(0xFFF2F3F5),
borderRadius: BorderRadius.circular(8),
@@ -125,7 +143,11 @@ class _HomeV2PageState extends State<HomeV2Page> {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.cloud_queue, size: 16, color: Color(0xFF165DFF)),
const Icon(
Icons.cloud_queue,
size: 16,
color: Color(0xFF165DFF),
),
const SizedBox(width: 6),
const Text(
'多云 28°C',
@@ -141,7 +163,10 @@ class _HomeV2PageState extends State<HomeV2Page> {
const SizedBox(width: 8),
Expanded(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 8,
),
decoration: BoxDecoration(
color: const Color(0xFFFFF0F0),
borderRadius: BorderRadius.circular(8),
@@ -149,7 +174,11 @@ class _HomeV2PageState extends State<HomeV2Page> {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.warning_amber_rounded, size: 16, color: Color(0xFFF53F3F)),
const Icon(
Icons.warning_amber_rounded,
size: 16,
color: Color(0xFFF53F3F),
),
const SizedBox(width: 6),
const Expanded(
child: Text(
@@ -161,7 +190,11 @@ class _HomeV2PageState extends State<HomeV2Page> {
),
),
const SizedBox(width: 4),
const Icon(Icons.arrow_forward_ios, size: 12, color: Color(0xFFF53F3F)),
const Icon(
Icons.arrow_forward_ios,
size: 12,
color: Color(0xFFF53F3F),
),
],
),
),
@@ -173,7 +206,9 @@ class _HomeV2PageState extends State<HomeV2Page> {
const SizedBox(height: 10),
StatsGrid(data: state.homeData),
const SizedBox(height: 10),
PlantOverviewCard(overview: state.homeData.plantOverview),
PlantOverviewCard(
overview: state.homeData.plantOverview,
),
const SizedBox(height: 10),
WorkOrderCard(stats: state.homeData.workOrderStats),
const SizedBox(height: 10),
@@ -182,7 +217,8 @@ class _HomeV2PageState extends State<HomeV2Page> {
PowerTrendChart(
data: state.homeData.powerTrendData,
trendType: state.trendType,
onToggleType: (type) => _bloc.add(HomeV2ToggleTrendType(type)),
onToggleType: (type) =>
_bloc.add(HomeV2ToggleTrendType(type)),
),
const SizedBox(height: 40),
]),
@@ -215,14 +251,14 @@ class _HomeV2PageState extends State<HomeV2Page> {
void _showPlantSelector() {
if (_bloc.state is! HomeV2Loaded) return;
final currentState = _bloc.state as HomeV2Loaded;
final sites = currentState.sites;
if (sites.isEmpty) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('暂无可用电站')),
);
ScaffoldMessenger.of(
context,
).showSnackBar(const SnackBar(content: Text('暂无可用电站')));
return;
}
@@ -237,7 +273,7 @@ class _HomeV2PageState extends State<HomeV2Page> {
bloc: _bloc,
builder: (context, state) {
if (state is! HomeV2Loaded) return Container();
return Container(
padding: const EdgeInsets.all(14),
constraints: BoxConstraints(
@@ -262,20 +298,24 @@ class _HomeV2PageState extends State<HomeV2Page> {
itemBuilder: (context, index) {
final site = state.sites[index];
final isSelected = state.selectedSite?.id == site.id;
return ListTile(
title: Text(site.siteName),
subtitle: site.siteCode != null && site.siteCode!.isNotEmpty
subtitle:
site.siteCode != null && site.siteCode!.isNotEmpty
? Text('编号: ${site.siteCode}')
: null,
trailing: isSelected
? const Icon(Icons.check, color: Color(0xFF165DFF))
? const Icon(
Icons.check,
color: Color(0xFF165DFF),
)
: null,
onTap: () {
// 更新全局选中的场站
sl<SiteCubit>().selectSite(site);
Navigator.pop(context);
// 切换场站后,重新加载首页数据
_bloc.add(const HomeV2LoadData());
},
@@ -291,4 +331,25 @@ class _HomeV2PageState extends State<HomeV2Page> {
},
);
}
// 显示设备状态模态框 - 从底部滑出
void _showDeviceStatusModal(BuildContext context) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
backgroundColor: Colors.transparent,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16),
),
),
builder: (BuildContext context) {
return BlocProvider.value(
value: context.read<DeviceStatusBloc>(),
child: const DeviceStatusModal(),
);
},
);
}
}