Commit 701001d6 authored by 张宏's avatar 张宏

宠物信息调整

parent e5f6d0a9
......@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:laki_icu_app/enums/video_stream_mode_enum.dart';
import 'package:laki_icu_app/models/bo/monitoring_bo.dart';
import 'package:laki_icu_app/services/monitoring_service.dart';
import 'package:laki_icu_app/services/p2p_video_service.dart';
import 'package:laki_icu_app/services/webrtc_service.dart';
......@@ -342,6 +343,29 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> {
));
}
/// 清空宠物信息(出舱)
void clearPatientInfo() {
if (isClosed) return;
emit(state.copyWith(clearPatientInfo: true));
}
/// 设置测试宠物信息(绑定宠物)
void setTestPatientInfo() {
if (isClosed) return;
final testPatientInfo = PatientInfoBO(
name: '妮蔻',
type: '猫',
phone: '130-1111-3333',
breed: '长毛三花',
doctor: '张医生',
disease: '胃炎',
checkInDate: '2025-6-15',
careLevel: '特级',
avatarUrl: '',
);
emit(state.copyWith(patientInfo: testPatientInfo));
}
/// 获取 WebRTC 渲染器供 UI 层使用
WebrtcService get webrtcService => _webrtcService;
......
......@@ -107,13 +107,14 @@ class MonitoringIndexState extends Equatable {
McuReport? latestMcuReport,
bool clearBoundBluetoothDevice = false,
bool clearLatestMcuReport = false,
bool clearPatientInfo = false,
}) {
return MonitoringIndexState(
status: status ?? this.status,
isLoading: isLoading ?? this.isLoading,
error: error ?? this.error,
metrics: metrics ?? this.metrics,
patientInfo: patientInfo ?? this.patientInfo,
patientInfo: clearPatientInfo ? null : patientInfo ?? this.patientInfo,
alerts: alerts ?? this.alerts,
videoConnectionState: videoConnectionState ?? this.videoConnectionState,
videoStreamMode: videoStreamMode ?? this.videoStreamMode,
......
......@@ -98,7 +98,11 @@ class _MonitoringIndexContentState extends State<MonitoringIndexContent> {
children: [
Expanded(
flex: 26,
child: MonitoringPetInfoCard(patientInfo: state.patientInfo),
child: MonitoringPetInfoCard(
patientInfo: state.patientInfo,
onExit: () => _monitoringIndexCubit.clearPatientInfo(),
onBindPet: () => _monitoringIndexCubit.setTestPatientInfo(),
),
),
SizedBox(width: 24.w),
Expanded(
......
......@@ -3,7 +3,6 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_switch/flutter_switch.dart';
import 'package:laki_icu_app/models/bo/monitoring_bo.dart';
import 'monitoring_panel.dart';
class MonitoringMetricCard extends StatelessWidget {
final MonitoringMetricBO metric;
......
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class MonitoringPanel extends StatelessWidget {
final String backgroundAsset;
final Widget child;
final EdgeInsetsGeometry? padding;
final BorderRadiusGeometry? borderRadius;
final BoxFit fit;
const MonitoringPanel({
super.key,
required this.backgroundAsset,
required this.child,
this.padding,
this.borderRadius,
this.fit = BoxFit.fill,
});
@override
Widget build(BuildContext context) {
return ClipRRect(
// borderRadius: borderRadius ?? BorderRadius.circular(18.r),
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(backgroundAsset),
fit: fit,
),
),
child: Padding(
padding: padding ?? EdgeInsets.all(18.w),
child: child,
),
),
);
}
}
......@@ -2,14 +2,17 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:laki_icu_app/models/bo/monitoring_bo.dart';
import 'monitoring_panel.dart';
class MonitoringPetInfoCard extends StatelessWidget {
final PatientInfoBO? patientInfo;
final VoidCallback? onExit;
final VoidCallback? onBindPet;
const MonitoringPetInfoCard({
super.key,
required this.patientInfo,
this.onExit,
this.onBindPet,
});
@override
......@@ -25,11 +28,193 @@ class MonitoringPetInfoCard extends StatelessWidget {
}
Widget _buildEmpty() {
return Center(
child: Text(
'暂无宠物信息',
style: TextStyle(color: Colors.white70, fontSize: 20.sp),
return Column(
children: [
SizedBox(height: 10.h),
// 顶部区域 - 空闲舱
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 150.w,
height: 160.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.r),
color: const Color(0xFF1F4E79).withOpacity(0.3),
),
child: Center(
child: Icon(
Icons.pets,
color: const Color(0xFFAAFAFF).withOpacity(0.5),
size: 80.w,
),
),
),
SizedBox(width: 24.w),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'空闲舱',
style: TextStyle(
color: Colors.white,
fontSize: 40.sp,
fontWeight: FontWeight.w700,
height: 1.2,
),
),
SizedBox(height: 20.h),
Text(
'已就绪可入住',
style: TextStyle(
color: const Color(0xFFB8E8FF),
fontSize: 25.sp,
),
),
],
),
),
],
),
SizedBox(height: 132.h),
// 猫咪图片
Image.asset(
'lib/assets/monitoring/cat_sleep.png',
width: 254.w,
height: 132.h,
fit: BoxFit.contain,
),
SizedBox(height: 20.h),
// 护理等级区域
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'护理等级',
style: TextStyle(
color: Colors.white,
fontSize: 30.sp,
fontWeight: FontWeight.w600,
),
),
SizedBox(height: 41.h),
Text(
'暂无',
style: TextStyle(
color: Colors.white,
fontSize: 64.sp,
fontWeight: FontWeight.bold,
letterSpacing: 8.w,
),
),
SizedBox(height: 55.h),
// 进度条
Container(
padding: EdgeInsets.symmetric(horizontal: 4.w),
decoration: BoxDecoration(
color: const Color(0xFF0A1A2E),
borderRadius: BorderRadius.circular(6.r),
),
child: Row(
children: [
Expanded(
child: Container(
margin: EdgeInsets.symmetric(horizontal: 2.w),
height: 10.h,
decoration: BoxDecoration(
color: const Color(0xFFFFFFFF),
borderRadius: BorderRadius.circular(2.r),
boxShadow: const [
BoxShadow(
color: Color(0x99FFFFFF),
blurRadius: 6,
),
],
),
),
),
Expanded(
child: Container(
margin: EdgeInsets.symmetric(horizontal: 2.w),
height: 10.h,
decoration: BoxDecoration(
color: const Color(0xFF25E5B0).withOpacity(0.3),
borderRadius: BorderRadius.circular(2.r),
),
),
),
Expanded(
child: Container(
margin: EdgeInsets.symmetric(horizontal: 2.w),
height: 10.h,
decoration: BoxDecoration(
color: const Color(0xFFFFB347).withOpacity(0.3),
borderRadius: BorderRadius.circular(2.r),
),
),
),
Expanded(
child: Container(
margin: EdgeInsets.symmetric(horizontal: 2.w),
height: 10.h,
decoration: BoxDecoration(
color: const Color(0xFFFF7A4D).withOpacity(0.3),
borderRadius: BorderRadius.circular(2.r),
),
),
),
Expanded(
child: Container(
margin: EdgeInsets.symmetric(horizontal: 2.w),
height: 10.h,
decoration: BoxDecoration(
color: const Color(0xFFFF4E4E).withOpacity(0.3),
borderRadius: BorderRadius.circular(2.r),
),
),
),
],
),
),
],
),
SizedBox(height: 26.h),
// 绑定宠物按钮
GestureDetector(
onTap: onBindPet,
child: Container(
width: double.infinity,
height: 140.h,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('lib/assets/monitoring/title_bg_spacewalk.png'),
fit: BoxFit.fill,
),
),
child: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(width: 24.w),
Text(
'绑定宠物',
style: TextStyle(
color: Colors.white,
fontSize: 32.sp,
fontWeight: FontWeight.w700,
letterSpacing: 4.w,
),
),
SizedBox(width: 24.w),
],
),
),
),
),
],
);
}
......@@ -45,9 +230,10 @@ class MonitoringPetInfoCard extends StatelessWidget {
_buildInfoBlock(info),
SizedBox(height: 20.h),
_buildDivider(),
SizedBox(height: 40.h),
SizedBox(height: 30.h),
_buildCareLevelBlock(info),
SizedBox(height: 20.h),
SizedBox(height: 25.h),
_buildExitButton(),
],
);
......@@ -209,11 +395,11 @@ class MonitoringPetInfoCard extends StatelessWidget {
'护理等级',
style: TextStyle(
color: Colors.white,
fontSize: 24.sp,
fontSize: 30.sp,
fontWeight: FontWeight.w600,
),
),
SizedBox(height: 20.h),
SizedBox(height: 40.h),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
......@@ -240,7 +426,7 @@ class MonitoringPetInfoCard extends StatelessWidget {
),
],
),
SizedBox(height: 20.h),
SizedBox(height: 49.h),
_buildLevelBar(),
],
);
......@@ -293,7 +479,9 @@ class MonitoringPetInfoCard extends StatelessWidget {
}
Widget _buildExitButton() {
return Container(
return GestureDetector(
onTap: onExit,
child: Container(
width: double.infinity,
height: 140.h,
decoration: const BoxDecoration(
......@@ -306,8 +494,6 @@ class MonitoringPetInfoCard extends StatelessWidget {
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.chevron_left, color: const Color(0xFF77EFFF), size: 30.w),
Icon(Icons.chevron_left, color: const Color(0xFF77EFFF), size: 30.w),
SizedBox(width: 24.w),
Text(
'出舱',
......@@ -319,11 +505,10 @@ class MonitoringPetInfoCard extends StatelessWidget {
),
),
SizedBox(width: 24.w),
Icon(Icons.chevron_right, color: const Color(0xFF77EFFF), size: 30.w),
Icon(Icons.chevron_right, color: const Color(0xFF77EFFF), size: 30.w),
],
),
),
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'monitoring_panel.dart';
class MonitoringVideoCard extends StatelessWidget {
const MonitoringVideoCard({super.key});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment