This commit is contained in:
wyf
2025-05-23 14:51:09 +08:00
parent 8a418c9c98
commit c650bad8b1
36 changed files with 1297 additions and 892 deletions

View File

@@ -1,5 +1,4 @@
import 'dart:async';
import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
@@ -18,7 +17,8 @@ import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
import 'package:vbvs_app/pages/device/component/DeviceDataComponentWidget.dart';
class BodyDeviceWidget extends StatefulWidget {
const BodyDeviceWidget({super.key});
var type;
BodyDeviceWidget({super.key, required this.type});
@override
State<BodyDeviceWidget> createState() => _BodyDevicePageState();
@@ -29,6 +29,7 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
final BodyDeviceController bodyDeviceController = Get.find();
HomeController homeController = Get.find();
final GlobalKey addIconKey = GlobalKey();
final ScrollController _scrollController = ScrollController();
OverlayEntry? _popupEntry;
Timer? _timer;
@@ -36,7 +37,6 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
final renderBox =
addIconKey.currentContext?.findRenderObject() as RenderBox?;
if (renderBox == null) return;
final position = renderBox.localToGlobal(Offset.zero);
final size = renderBox.size;
double popupWidth = 190.rpx;
@@ -44,7 +44,7 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
// 移除之前的弹窗
_popupEntry?.remove();
// 创建新的 OverlayEntry
// 创建新的OverlayEntry
_popupEntry = OverlayEntry(
builder: (context) => Stack(
children: [
@@ -54,7 +54,6 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
color: Colors.transparent,
onDismiss: _hidePopup,
),
// 弹窗内容
Positioned(
top: position.dy + size.height + 26.rpx,
@@ -143,7 +142,7 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
),
);
// 插入新的 OverlayEntry
// 插入新的OverlayEntry
Overlay.of(context)!.insert(_popupEntry!);
}
@@ -156,17 +155,39 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
void initState() {
bodyDeviceController.keyWord.value = "";
super.initState();
// 初次请求一次
_fetchDeviceList();
// 每 5 秒定时请求一次
// 处理传入的type参数
if (widget.type != null && widget.type is Map) {
final bindType = widget.type['bind_type'];
final mac = widget.type['mac'];
if (bindType != null) {
bodyDeviceController.model.type = bindType;
homeController.model.type = bindType;
}
// 初次请求设备列表
_fetchDeviceList().then((_) {
if (mac != null) {
// 延迟执行以确保列表已渲染
WidgetsBinding.instance.addPostFrameCallback((_) {
_scrollToDeviceWithMac(mac);
});
}
});
} else {
// 没有传入type时的默认逻辑
_fetchDeviceList();
}
// 每5秒定时请求一次
_timer = Timer.periodic(Duration(seconds: 5), (timer) {
_fetchDeviceList();
});
}
void _fetchDeviceList() {
bodyDeviceController.getDeviceList().then((apiResponse) {
Future<void> _fetchDeviceList() async {
await bodyDeviceController.getDeviceList().then((apiResponse) {
if (apiResponse.code != HttpStatusCodes.ok) {
TopSlideNotification.show(
Get.context!,
@@ -177,9 +198,32 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
});
}
void _scrollToDeviceWithMac(String mac) {
final deviceList = bodyDeviceController.deviceList.value;
final index = deviceList.indexWhere((device) => device['mac'] == mac);
if (index != -1 && _scrollController.hasClients) {
// 动态计算高度:最小为 501.rpx最大为 26.6% 屏幕高度
final screenHeight = MediaQuery.of(Get.context!).size.height;
final dynamicItemHeight = (screenHeight * 0.266).rpx;
final itemHeight =
dynamicItemHeight < 501.rpx ? 501.rpx : dynamicItemHeight;
final spacing = 25.rpx;
final targetPosition = index * (itemHeight + spacing);
_scrollController.animateTo(
targetPosition,
duration: const Duration(milliseconds: 500),
curve: Curves.easeInOut,
);
}
}
@override
void dispose() {
_timer?.cancel(); // 页面销毁时取消定时器
_scrollController.dispose();
super.dispose();
}
@@ -189,16 +233,14 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
builder: (context, bodysize) => GestureDetector(
onTap: () => FocusScope.of(context).unfocus(),
child: Container(
// width: bodysize.maxWidth,
// height: bodysize.maxHeight * 1,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/img/bgNoImg.png'), // 本地图片
fit: BoxFit.fill, // 填满整个 Container
image: AssetImage('assets/img/bgNoImg.png'),
fit: BoxFit.fill,
),
),
child: Scaffold(
backgroundColor: Colors.transparent, // 加上这一行
backgroundColor: Colors.transparent,
appBar: AppBar(
backgroundColor: themeController.currentColor.sc17,
automaticallyImplyLeading: false,
@@ -216,7 +258,7 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
Text(
'体征检测设备.标题'.tr,
style: TextStyle(
fontFamily: 'Readex Pro',
fontFamily: 'ReadexPro',
color: themeController.currentColor.sc3,
letterSpacing: 0,
fontSize: 30.rpx,
@@ -224,7 +266,6 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
),
Positioned(
left: 0,
// child: returnIconButtom,
child: returnIconButtomAddCallback(() {
bodyDeviceController.getDeviceNum();
bodyDeviceController.getDeviceList();
@@ -316,10 +357,8 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
mainAxisSize: MainAxisSize.max,
children: [
Container(
width:
160.rpx, // 固定宽度为 160.rpx
alignment:
Alignment.center, // 文字居中
width: 160.rpx,
alignment: Alignment.center,
child: Text(
'体征检测设备.我的e护'.tr,
style: FlutterFlowTheme.of(
@@ -372,10 +411,8 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
mainAxisSize: MainAxisSize.max,
children: [
Container(
width:
160.rpx, // 固定宽度为 160.rpx
alignment:
Alignment.center, // 文字居中
width: 160.rpx,
alignment: Alignment.center,
child: Text(
'体征检测设备.云关爱'.tr,
style: FlutterFlowTheme.of(
@@ -407,19 +444,18 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
],
),
Obx(() {
// 横线宽度固定为 160.rpx
// 横线宽度固定为160.rpx
double lineWidth = 160.rpx;
return AnimatedPositioned(
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
bottom: 0,
left: bodyDeviceController.model.type ==
1
? 0
: 160.rpx, // 第二个按钮横线从 160.rpx 开始
left:
bodyDeviceController.model.type == 1
? 0
: 160.rpx,
child: Container(
width: lineWidth, // 横线宽度固定为 160.rpx
width: lineWidth,
height: 4.rpx,
decoration: BoxDecoration(
color: themeController
@@ -482,12 +518,12 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
.of(context)
.labelMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor
.sc4),
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
enabledBorder:
OutlineInputBorder(
borderSide: BorderSide(
@@ -625,6 +661,7 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 26.rpx, 30.rpx, 0),
child: SingleChildScrollView(
controller: _scrollController,
child: Column(
mainAxisSize: MainAxisSize.max,
children: bodyDeviceController
@@ -653,7 +690,7 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
Widget _buildDeviceCard(BuildContext context,
{required String title, required String imageUrl, required String type}) {
return CustomCard(
borderRadius: 20.rpx, // 圆角大小
borderRadius: 20.rpx,
onTap: () {
if (type != null) {
if (type == '1') {
@@ -661,7 +698,7 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
}
}
},
colors: [themeController.currentColor.sc17], // 背景色
colors: [themeController.currentColor.sc17],
child: Container(
width: double.infinity,
height: MediaQuery.sizeOf(context).height * 0.135,

View File

@@ -97,7 +97,7 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
final menuWidth = _calculateMaxMenuItemWidth(allTexts, textStyle);
popupWidth = menuWidth;
// 计算弹窗需要的实际高度(估算)
final estimatedItemHeight = 60.rpx; // 每个菜单项的估算高度
final estimatedItemHeight = 66.rpx; // 每个菜单项的估算高度
//todo 更新菜单项,需要在此添加数量
final itemCount =
widget.device['bind_type'] == BindType.active.code ? 9 : 5;
@@ -210,7 +210,9 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
// ),
child: Column(
mainAxisSize: MainAxisSize.min,
children: _buildMenuItems(),
children: _buildMenuItems().divide(SizedBox(
height: 6.rpx,
)),
),
);
@@ -228,7 +230,9 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
// 构建共享设备的菜单项
Widget _buildSharedDeviceContent(Widget content) {
return content;
return IntrinsicWidth(
child: content,
);
}
// 构建菜单项列表
@@ -299,7 +303,8 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
_popupEntry?.remove();
_popupEntry = null;
BlueteethBindController blueteethBindController = Get.find();
blueteethBindController.currentDeviceMac?.value = widget.device['mac'];
blueteethBindController.currentDeviceMac?.value =
widget.device['mac'];
Get.toNamed("/calibrationPage", arguments: 2);
},
),
@@ -342,7 +347,9 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
},
),
_buildMenuItem(
text: "体征检测设备.删除".tr,
text: widget.device['bind_type'] == BindType.active.code
? "解绑".tr
: "删除".tr,
onTap: () {
setState(() {
_isPopupOpen = false;
@@ -745,13 +752,15 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
),
),
Text(
'uusne12',
(widget.device['source']?.toString().isEmpty ?? true)
? '未知数据'.tr
: widget.device['source'].toString(),
style:
FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
color: themeController.currentColor.sc3,
),
),
].divide(SizedBox(width: 34.rpx)),
@@ -798,7 +807,9 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
mainAxisSize: MainAxisSize.max,
children: [
if (widget.device['status']['signal'] != null &&
widget.device['status']['signal'] != -1)
widget.device['status']['signal'] != -1 &&
widget.device['status']['status'] != null &&
widget.device['status']['status'] == 1)
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: Colors.grey, // 或根据你主题定制颜色
@@ -842,7 +853,9 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
fit: BoxFit.fill,
),
),
if (widget.device['status']['inBed'] != null)
if (widget.device['status']['inBed'] != null &&
widget.device['status']['status'] != null &&
widget.device['status']['status'] == 1)
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: Colors.grey, // 可根据需要更换颜色
@@ -889,7 +902,9 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
),
),
),
if (widget.device['status']['failure'] != 0)
if (widget.device['status']['failure'] != 0 &&
widget.device['status']['status'] != null &&
widget.device['status']['status'] == 1)
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: Colors.grey, // 可自定义点击水波纹颜色
@@ -934,7 +949,9 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
),
),
),
if (widget.device['status']['upgrade'] != 0)
if (widget.device['status']['upgrade'] != 0 &&
widget.device['status']['status'] != null &&
widget.device['status']['status'] == 1)
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: Colors.grey, // 可自定义点击效果颜色
@@ -954,7 +971,8 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
),
),
),
if (widget.device['status']['status'] != null)
if (widget.device['status']['status'] != null &&
widget.device['status']['status'] == 0)
ClickableContainer(
backgroundColor: Colors.transparent,
highlightColor: Colors.grey, // 可替换为点击高亮色
@@ -997,9 +1015,10 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
width: 27.rpx,
height: 27.rpx,
child: SvgPicture.asset(
widget.device['status']['status'] == 1
? 'assets/img/icon/device_online.svg'
: 'assets/img/icon/device_offline.svg',
// widget.device['status']['status'] == 1
// ? 'assets/img/icon/device_online.svg'
// : 'assets/img/icon/device_offline.svg',
'assets/img/icon/device_issue.svg',
fit: BoxFit.cover,
),
),
@@ -1017,44 +1036,92 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () async {
// personController.currentPersonId = widget.device
if (widget.device['person'] != null) {
personController.currentPersonId.value =
widget.device['_id'];
personController.name.value =
widget.device['person']['name'];
personController.gender.value =
widget.device['person']['gender'] ?? 1;
personController.weight.value =
widget.device['person']['weight'] ?? 0;
personController.height.value =
widget.device['person']['height'] ?? 0;
personController.selectedDiseaseIds.value =
widget.device['person']['disease'] ?? [];
personController.birthday.value =
widget.device['person']['birthday'] ?? '';
personController.dateTime = MyUtils.formatBirthdayTime(
widget.device['person']['birthday']);
} else {
personController.currentPersonId.value =
widget.device['_id'];
}
await Get.toNamed("/updatePersonPage",
arguments: widget.device['bind_type']);
bodyDeviceController.getDeviceList();
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0.rpx, 0.rpx, 0.rpx),
Expanded(
// 使用 Expanded 来占据屏幕宽度
child: CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () async {
if (widget.device['person'] != null) {
personController.currentPersonId.value =
widget.device['_id'];
personController.name.value =
widget.device['person']['name'];
personController.gender.value =
widget.device['person']['gender'] ?? 1;
personController.weight?.value =
widget.device['person']['weight'].toString() ??
"";
personController.height.value =
widget.device['person']['height'].toString() ??
"";
personController.selectedDiseaseIds.value =
widget.device['person']['disease'] ?? [];
personController.birthday.value =
widget.device['person']['birthday'] ?? '';
personController.dateTime =
MyUtils.formatBirthdayTime(
widget.device['person']['birthday']);
} else {
personController.currentPersonId.value =
widget.device['_id'];
}
await Get.toNamed("/updatePersonPage",
arguments: widget.device['bind_type']);
bodyDeviceController.getDeviceList();
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0.rpx, 0.rpx, 0.rpx),
child: Container(
alignment: Alignment.center,
height: MediaQuery.sizeOf(context).height * 0.0037,
constraints: BoxConstraints(
minWidth: 143.rpx,
minHeight: 61.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"体征检测设备.人员资料".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 17.rpx)),
),
),
),
),
),
SizedBox(
width: 20.rpx,
),
Expanded(
// 使用 Expanded 来占据屏幕宽度
child: CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
Get.toNamed("/instantBodyPage",
arguments: widget.device);
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: MediaQuery.sizeOf(context).width * 0.19,
alignment: Alignment.center,
height: MediaQuery.sizeOf(context).height * 0.0037,
constraints: BoxConstraints(
minWidth: 143.rpx,
@@ -1063,10 +1130,9 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"体征检测设备.人员资料".tr,
"体征检测设备.实时体征".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
@@ -1082,112 +1148,104 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
),
),
),
CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
Get.toNamed("/instantBodyPage", arguments: widget.device);
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: MediaQuery.sizeOf(context).width * 0.19,
height: MediaQuery.sizeOf(context).height * 0.0037,
constraints: BoxConstraints(
minWidth: 143.rpx,
minHeight: 61.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"体征检测设备.实时体征".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize: AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
],
),
SizedBox(
height: 20.rpx,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Expanded(
// 使用 Expanded 来占据屏幕宽度的一半
child: CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
TopSlideNotification.show(context, text: "待开发功能".tr);
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0.rpx, 0.rpx, 0.rpx),
child: Container(
alignment: Alignment.center,
height: MediaQuery.sizeOf(context).height * 0.0037,
constraints: BoxConstraints(
minWidth: 143.rpx,
minHeight: 61.rpx,
),
].divide(SizedBox(width: 17.rpx)),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"体征检测设备.消息回看".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 17.rpx)),
),
),
),
),
),
CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
TopSlideNotification.show(context, text: "待开发功能".tr);
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: MediaQuery.sizeOf(context).width * 0.19,
height: MediaQuery.sizeOf(context).height * 0.0037,
constraints: BoxConstraints(
minWidth: 143.rpx,
minHeight: 61.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"体征检测设备.消息回看".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize: AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 17.rpx)),
),
),
SizedBox(
width: 20.rpx,
),
CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
String mac = widget.device['mac'];
String sleepReportUrl =
"${ServiceConstant.sleep_report_url}?mac=${mac}&token=${ServiceConstant.sleep_token}";
Get.toNamed("/sleepReportPage",
arguments: sleepReportUrl);
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Container(
width: MediaQuery.sizeOf(context).width * 0.19,
height: MediaQuery.sizeOf(context).height * 0.0037,
constraints: BoxConstraints(
minWidth: 143.rpx,
minHeight: 61.rpx,
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"体征检测设备.健康报告".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize: AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
Expanded(
// 使用 Expanded 来占据屏幕宽度的一半
child: CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
String mac = widget.device['mac'];
String sleepReportUrl =
"${ServiceConstant.sleep_report_url}?mac=${mac}&token=${ServiceConstant.sleep_token}";
Get.toNamed("/sleepReportPage",
arguments: sleepReportUrl);
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0.rpx, 0.rpx, 0.rpx),
child: Container(
alignment: Alignment.center,
height: MediaQuery.sizeOf(context).height * 0.0037,
constraints: BoxConstraints(
minWidth: 143.rpx,
minHeight: 61.rpx,
),
].divide(SizedBox(width: 17.rpx)),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"体征检测设备.健康报告".tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
color: themeController.currentColor.sc3,
fontFamily: 'Inter',
fontSize:
AppConstants().normal_text_fontSize,
letterSpacing: 0.0,
),
),
].divide(SizedBox(width: 17.rpx)),
),
),
),
),
),

View File

@@ -173,354 +173,375 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
),
body: SafeArea(
top: true,
child: Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0.rpx, 29.rpx, 0.rpx, 0.rpx),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 0.rpx, 30.rpx, 120.rpx),
child: ClickableContainer(
backgroundColor: themeController.currentColor.sc5,
highlightColor:
themeController.currentColor.sc5, // 或你希望的点击水波纹颜色
borderRadius: AppConstants()
.normal_container_radius, // 如果你想加圆角可以设置 eg. 12.rpx
padding: EdgeInsets.zero,
onTap: () {
print('点击了体征卡片');
},
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
flex: 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Text(
'实时体征.姓名'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
Text(
'实时体征.年龄'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
].divide(SizedBox(height: 34.rpx)),
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${device['person']?['name'] ?? '未命名'.tr}',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
Text(
'${MyUtils.getAgeByDate(MyUtils.formatBirthdayTime(device['person']?['birthday'])) ?? '未知数据'.tr}',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
].divide(SizedBox(height: 34.rpx)),
),
]
.divide(SizedBox(width: 33.rpx))
.addToStart(SizedBox(width: 37.rpx)),
),
]
.addToStart(SizedBox(height: 36.rpx))
.addToEnd(SizedBox(height: 36.rpx)),
),
),
Expanded(
flex: 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Text(
'实时体征.设备ID'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
Text(
'实时体征.体重'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
].divide(SizedBox(height: 34.rpx)),
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${device['code'] ?? '未知数据'.tr}',
// "D11250300003",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
Text(
'${device['person']?['weight'] ?? '未知数据'.tr}kg',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
].divide(SizedBox(height: 34.rpx)),
),
]
.divide(SizedBox(width: 33.rpx))
.addToStart(SizedBox(width: 37.rpx)),
),
]
.addToStart(SizedBox(height: 36.rpx))
.addToEnd(SizedBox(height: 36.rpx)),
),
),
],
),
),
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
(onlineState == "离线".tr || inBed == '离床'.tr)
? 'assets/img/black_body_still.png' // 静态图
: 'assets/img/body_black.gif', // 动图
),
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
66.rpx, 0, 66.rpx, 0),
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
onlineState == "离线".tr
? 'assets/img/black_body_still.jpg' // 静态图
: 'assets/img/body_black.gif', // 动图
),
fit: BoxFit.cover,
fit: BoxFit.cover,
),
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 29.rpx, 0.rpx, 0.rpx),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 0.rpx, 30.rpx, 120.rpx),
child: ClickableContainer(
backgroundColor: themeController.currentColor.sc5,
highlightColor:
themeController.currentColor.sc5, // 或你希望的点击水波纹颜色
borderRadius: AppConstants()
.normal_container_radius, // 如果你想加圆角可以设置 eg. 12.rpx
padding: EdgeInsets.zero,
onTap: () {
print('点击了体征卡片');
},
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
Expanded(
flex: 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Text(
'实时体征.姓名'.tr,
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
Text(
'实时体征.年龄'.tr,
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
].divide(SizedBox(height: 34.rpx)),
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${device['person']?['name'] ?? '未命名'.tr}',
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
Text(
'${MyUtils.getAgeByDate(MyUtils.formatBirthdayTime(device['person']?['birthday'])) ?? '未知数据'.tr}',
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
].divide(SizedBox(height: 34.rpx)),
),
]
.divide(SizedBox(width: 33.rpx))
.addToStart(SizedBox(width: 37.rpx)),
),
]
.addToStart(SizedBox(height: 36.rpx))
.addToEnd(SizedBox(height: 36.rpx)),
),
),
child: Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
DeviceStatusInfoWidget(
title: "在离床".tr,
iconAsset:
"assets/img/icon/bed_status.svg",
value: inBed,
),
DeviceStatusInfoWidget(
title: "体动".tr,
iconAsset:
"assets/img/icon/bodymotion.svg",
value: (bodyMotion == null ||
bodyMotion == -1)
? "未知数据".tr
: "$bodyMotion",
),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
DeviceStatusInfoWidget(
title: "心率".tr,
iconAsset: "assets/img/icon/heart.svg",
value: (heartrate == null ||
heartrate == -1)
? "未知数据".tr
: "$heartrate",
),
DeviceStatusInfoWidget(
title: "打鼾".tr,
iconAsset: "assets/img/icon/snore.svg",
value: '${snores}'.tr,
),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
DeviceStatusInfoWidget(
title: "呼吸".tr,
iconAsset:
"assets/img/icon/breathe.svg",
value: (breathrate == null ||
breathrate == -1)
? "未知数据".tr
: "$breathrate",
),
DeviceStatusInfoWidget(
title: "呼吸暂停".tr,
iconAsset:
"assets/img/icon/breathe_pause.svg",
value: '${breathState}',
),
],
),
].divide(SizedBox(height: 49.rpx)),
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 67.rpx, 0.rpx, 0.rpx),
child: Container(
height: 40.rpx,
child: Text(
bodyMotion >= maxBodyMotion ? '请保持静止'.tr : "",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc9,
Expanded(
flex: 1,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.end,
children: [
Text(
'实时体征.设备ID'.tr,
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
Text(
'实时体征.体重'.tr,
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
),
].divide(SizedBox(height: 34.rpx)),
),
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
'${device['code'] ?? '未知数据'.tr}',
// "D11250300003",
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
Text(
'${device['person']?['weight'] ?? '未知数据'.tr}kg',
style:
FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc3,
),
),
].divide(SizedBox(height: 34.rpx)),
),
]
.divide(SizedBox(width: 33.rpx))
.addToStart(SizedBox(width: 37.rpx)),
),
]
.addToStart(SizedBox(height: 36.rpx))
.addToEnd(SizedBox(height: 36.rpx)),
),
),
),
),
// SizedBox(
// height: 207.rpx,
// ),
],
),
)),
ClickableContainer(
backgroundColor: Colors.transparent, // 可自定义背景色
highlightColor: Colors.white, // 点击涟漪颜色
borderRadius: 16.rpx, // 圆角大小,可按需调整
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 0.rpx, 30.rpx, 0.rpx),
onTap: () {},
child: Container(
padding: EdgeInsetsDirectional.fromSTEB(
26.rpx, 26.rpx, 26.rpx, 26.rpx),
decoration: BoxDecoration(
// color: FlutterFlowTheme.of(context)
// .primaryBackground
// .withOpacity(0.6), // 半透明背景
borderRadius: BorderRadius.circular(16.rpx),
border: Border.all(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: 0.5.rpx,
],
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
),
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 8.rpx, 0, 0),
66.rpx, 0, 66.rpx, 0),
child: Container(
width: 23.rpx,
height: 23.rpx,
// width: double.infinity,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/tips.svg',
fit: BoxFit.cover,
color: themeController.currentColor.sc4,
// decoration: BoxDecoration(
// image: DecorationImage(
// image: AssetImage(
// onlineState == "离线".tr
// ? 'assets/img/black_body_still.png' // 静态图
// : 'assets/img/body_black.gif', // 动图
// ),
// fit: BoxFit.cover,
// ),
// ),
child: Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
DeviceStatusInfoWidget(
title: "在离床".tr,
iconAsset:
"assets/img/icon/bed_status.svg",
value: inBed,
),
DeviceStatusInfoWidget(
title: "体动".tr,
iconAsset:
"assets/img/icon/bodymotion.svg",
value: (bodyMotion == null ||
bodyMotion == -1)
? "未知数据".tr
: "$bodyMotion",
),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
DeviceStatusInfoWidget(
title: "心率".tr,
iconAsset:
"assets/img/icon/heart.svg",
value: (heartrate == null ||
heartrate == -1)
? "未知数据".tr
: "$heartrate",
),
DeviceStatusInfoWidget(
title: "打鼾".tr,
iconAsset:
"assets/img/icon/snore.svg",
value: '${snores}'.tr,
),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
DeviceStatusInfoWidget(
title: "呼吸".tr,
iconAsset:
"assets/img/icon/breathe.svg",
value: (breathrate == null ||
breathrate == -1)
? "未知数据".tr
: "$breathrate",
),
DeviceStatusInfoWidget(
title: "呼吸暂停".tr,
iconAsset:
"assets/img/icon/breathe_pause.svg",
value: '${breathState}',
),
],
),
].divide(SizedBox(height: 49.rpx)),
),
),
),
Expanded(
child: Text(
'实时体征.提示'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 67.rpx, 0.rpx, 0.rpx),
child: Container(
height: 40.rpx,
child: Text(
bodyMotion >= maxBodyMotion ? '请保持静止'.tr : "",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc9,
),
),
),
),
].divide(SizedBox(width: 23.rpx)),
// SizedBox(
// height: 207.rpx,
// ),
],
),
)),
ClickableContainer(
backgroundColor: Colors.transparent, // 可自定义背景色
highlightColor: Colors.white, // 点击涟漪颜色
borderRadius: 16.rpx, // 圆角大小,可按需调整
padding: EdgeInsetsDirectional.fromSTEB(
30.rpx, 0.rpx, 30.rpx, 0.rpx),
onTap: () {},
child: Container(
padding: EdgeInsetsDirectional.fromSTEB(
26.rpx, 26.rpx, 26.rpx, 26.rpx),
decoration: BoxDecoration(
// color: FlutterFlowTheme.of(context)
// .primaryBackground
// .withOpacity(0.6), // 半透明背景
borderRadius: BorderRadius.circular(16.rpx),
border: Border.all(
color: themeController.currentColor.sc4
.withOpacity(0.5),
width: 0.5.rpx,
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0, 8.rpx, 0, 0),
child: Container(
width: 23.rpx,
height: 23.rpx,
// width: double.infinity,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/tips.svg',
fit: BoxFit.cover,
color: themeController.currentColor.sc4,
),
),
),
Expanded(
child: Text(
'实时体征.提示'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
),
),
].divide(SizedBox(width: 23.rpx)),
),
),
),
),
SizedBox(
height: 26.rpx,
),
],
SizedBox(
height: 26.rpx,
),
],
),
),
),
),