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

宠物信息调整

parent e5f6d0a9
...@@ -3,6 +3,7 @@ import 'dart:async'; ...@@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:laki_icu_app/enums/video_stream_mode_enum.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/monitoring_service.dart';
import 'package:laki_icu_app/services/p2p_video_service.dart'; import 'package:laki_icu_app/services/p2p_video_service.dart';
import 'package:laki_icu_app/services/webrtc_service.dart'; import 'package:laki_icu_app/services/webrtc_service.dart';
...@@ -342,6 +343,29 @@ class MonitoringIndexCubit extends Cubit<MonitoringIndexState> { ...@@ -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 层使用 /// 获取 WebRTC 渲染器供 UI 层使用
WebrtcService get webrtcService => _webrtcService; WebrtcService get webrtcService => _webrtcService;
......
...@@ -107,13 +107,14 @@ class MonitoringIndexState extends Equatable { ...@@ -107,13 +107,14 @@ class MonitoringIndexState extends Equatable {
McuReport? latestMcuReport, McuReport? latestMcuReport,
bool clearBoundBluetoothDevice = false, bool clearBoundBluetoothDevice = false,
bool clearLatestMcuReport = false, bool clearLatestMcuReport = false,
bool clearPatientInfo = false,
}) { }) {
return MonitoringIndexState( return MonitoringIndexState(
status: status ?? this.status, status: status ?? this.status,
isLoading: isLoading ?? this.isLoading, isLoading: isLoading ?? this.isLoading,
error: error ?? this.error, error: error ?? this.error,
metrics: metrics ?? this.metrics, metrics: metrics ?? this.metrics,
patientInfo: patientInfo ?? this.patientInfo, patientInfo: clearPatientInfo ? null : patientInfo ?? this.patientInfo,
alerts: alerts ?? this.alerts, alerts: alerts ?? this.alerts,
videoConnectionState: videoConnectionState ?? this.videoConnectionState, videoConnectionState: videoConnectionState ?? this.videoConnectionState,
videoStreamMode: videoStreamMode ?? this.videoStreamMode, videoStreamMode: videoStreamMode ?? this.videoStreamMode,
......
...@@ -98,7 +98,11 @@ class _MonitoringIndexContentState extends State<MonitoringIndexContent> { ...@@ -98,7 +98,11 @@ class _MonitoringIndexContentState extends State<MonitoringIndexContent> {
children: [ children: [
Expanded( Expanded(
flex: 26, flex: 26,
child: MonitoringPetInfoCard(patientInfo: state.patientInfo), child: MonitoringPetInfoCard(
patientInfo: state.patientInfo,
onExit: () => _monitoringIndexCubit.clearPatientInfo(),
onBindPet: () => _monitoringIndexCubit.setTestPatientInfo(),
),
), ),
SizedBox(width: 24.w), SizedBox(width: 24.w),
Expanded( Expanded(
......
...@@ -2,8 +2,7 @@ import 'package:flutter/material.dart'; ...@@ -2,8 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_switch/flutter_switch.dart'; import 'package:flutter_switch/flutter_switch.dart';
import 'package:laki_icu_app/models/bo/monitoring_bo.dart'; import 'package:laki_icu_app/models/bo/monitoring_bo.dart';
import 'monitoring_panel.dart';
class MonitoringMetricCard extends StatelessWidget { class MonitoringMetricCard extends StatelessWidget {
final MonitoringMetricBO metric; 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,
),
),
);
}
}
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'monitoring_panel.dart';
class MonitoringVideoCard extends StatelessWidget { class MonitoringVideoCard extends StatelessWidget {
const MonitoringVideoCard({super.key}); 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