更新
This commit is contained in:
@@ -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)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user