Files
tuiche/lib/pages/device/component/DeviceDataComponentWidget.dart
2025-04-28 15:37:58 +08:00

1294 lines
62 KiB
Dart

import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/color/ServiceConstant.dart';
import 'package:vbvs_app/common/color/appConstants.dart';
import 'package:vbvs_app/common/color/app_uri_status.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/component/tool/ClickableContainer.dart';
import 'package:vbvs_app/component/tool/CustomCard.dart';
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
import 'package:vbvs_app/controller/device/body_device_controller.dart';
import 'package:vbvs_app/controller/person/person_controller.dart';
import 'package:vbvs_app/enum/BindType.dart';
import 'package:vbvs_app/model/api_response.dart';
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
class DeviceDataComponentWidget extends StatefulWidget {
final Map<String, dynamic> device;
const DeviceDataComponentWidget({super.key, required this.device});
@override
State<DeviceDataComponentWidget> createState() =>
_DeviceDataComponentWidgetState();
}
class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
final GlobalKey _arrowKey = GlobalKey();
OverlayEntry? _popupEntry;
BodyDeviceController bodyDeviceController = Get.find();
PersonController personController = Get.find();
@override
void dispose() {
_popupEntry?.remove();
super.dispose();
}
void _showPopup() {
final RenderBox? renderBox =
_arrowKey.currentContext?.findRenderObject() as RenderBox?;
if (renderBox == null) return;
final position = renderBox.localToGlobal(Offset.zero);
final size = renderBox.size;
final screenHeight = MediaQuery.of(context).size.height;
final popupHeight = 160.rpx;
final popupWidth = 190.rpx;
final paddingOffset = 10.rpx;
bool showAbove = (position.dy + size.height + popupHeight > screenHeight);
_popupEntry?.remove();
if (widget.device['bind_type'] == BindType.active.code) {
_popupEntry = OverlayEntry(
builder: (context) => GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
_popupEntry?.remove();
_popupEntry = null;
},
child: Stack(
children: [
Positioned(
top: showAbove
? position.dy - popupHeight - paddingOffset
: position.dy + size.height + paddingOffset,
left: position.dx + size.width - popupWidth,
child: Material(
color: Colors.transparent,
child: ConstrainedBox(
constraints: BoxConstraints(
maxWidth: 300.rpx, // 限制最大宽度
),
child: IntrinsicWidth(
// 自适应内容宽度
child: Container(
padding: EdgeInsets.all(20.rpx),
decoration: BoxDecoration(
color: themeController.currentColor.sc17,
borderRadius: BorderRadius.circular(12.rpx),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.2),
blurRadius: 12.rpx,
spreadRadius: 1.rpx,
offset: Offset(0, 6.rpx),
),
],
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// 首页展示
ClickableContainer(
padding: EdgeInsets.symmetric(vertical: 16.rpx),
backgroundColor: Colors.transparent,
highlightColor: themeController
.currentColor.sc16
.withOpacity(0.1),
borderRadius: 8.rpx,
onTap: () async {
ApiResponse apiResponse =
await bodyDeviceController
.updateDeviceShow(widget.device);
_popupEntry?.remove();
_popupEntry = null;
if (apiResponse.code == HttpStatusCodes.ok) {
bodyDeviceController.getDeviceList();
bodyDeviceController.updateAll();
} else {
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor:
themeController.currentColor.sc9,
);
}
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.center, // 这里!行居中
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
if (widget.device['show'] != null &&
widget.device['show'] == true)
SizedBox(
width: 24.rpx,
height: 24.rpx,
child: Icon(
Icons.check, // 使用Flutter内置的√图标
size: 24.rpx,
color:
themeController.currentColor.sc2,
),
),
if (widget.device['show'] == null ||
widget.device['show'] != true)
SizedBox(width: 24.rpx, height: 24.rpx),
SizedBox(width: 10.rpx),
Text(
"体征检测设备.首页展示".tr,
style: TextStyle(
fontSize:
AppConstants().normal_text_fontSize,
color: (widget.device['show'] != null &&
widget.device['show'] == true)
? themeController.currentColor.sc2
: themeController.currentColor.sc3,
),
),
],
),
),
// 设备详情
ClickableContainer(
padding: EdgeInsets.symmetric(vertical: 16.rpx),
backgroundColor: Colors.transparent,
highlightColor: themeController
.currentColor.sc16
.withOpacity(0.1),
borderRadius: 8.rpx,
onTap: () {
_popupEntry?.remove();
_popupEntry = null;
Get.toNamed("/deviceDetail",
arguments: widget.device);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
// 空占位
SizedBox(width: 24.rpx, height: 24.rpx),
SizedBox(width: 10.rpx),
Text(
"体征检测设备.设备详情".tr,
style: TextStyle(
fontSize:
AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
],
),
),
// wifi配置
ClickableContainer(
padding: EdgeInsets.symmetric(vertical: 16.rpx),
backgroundColor: Colors.transparent,
highlightColor: themeController
.currentColor.sc16
.withOpacity(0.1),
borderRadius: 8.rpx,
onTap: () {
_popupEntry?.remove();
_popupEntry = null;
Get.toNamed("/deviceDetail",
arguments: widget.device);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
// 空占位
SizedBox(width: 24.rpx, height: 24.rpx),
SizedBox(width: 10.rpx),
Text(
"WIFI配置".tr,
style: TextStyle(
fontSize:
AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
],
),
),
//分享设备
ClickableContainer(
padding: EdgeInsets.symmetric(vertical: 16.rpx),
backgroundColor: Colors.transparent,
highlightColor: themeController
.currentColor.sc16
.withOpacity(0.1),
borderRadius: 8.rpx,
onTap: () {
_popupEntry?.remove();
_popupEntry = null;
Get.toNamed("/deviceSharePage",
arguments: widget.device);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
// 空占位
SizedBox(width: 24.rpx, height: 24.rpx),
SizedBox(width: 10.rpx),
Text(
"分享设备".tr,
style: TextStyle(
fontSize:
AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
],
),
),
//消息设置
ClickableContainer(
padding: EdgeInsets.symmetric(vertical: 16.rpx),
backgroundColor: Colors.transparent,
highlightColor: themeController
.currentColor.sc16
.withOpacity(0.1),
borderRadius: 8.rpx,
onTap: () {
_popupEntry?.remove();
_popupEntry = null;
Get.toNamed("/deviceDetail",
arguments: widget.device);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
// 空占位
SizedBox(width: 24.rpx, height: 24.rpx),
SizedBox(width: 10.rpx),
Text(
"消息设置".tr,
style: TextStyle(
fontSize:
AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
],
),
),
// 重命名
ClickableContainer(
padding: EdgeInsets.symmetric(vertical: 16.rpx),
backgroundColor: Colors.transparent,
highlightColor: themeController
.currentColor.sc16
.withOpacity(0.1),
borderRadius: 8.rpx,
onTap: () {
_popupEntry?.remove();
_popupEntry = null;
personController.currentPersonId.value =
widget.device['_id'];
personController.name.value = "";
showConfirmDialog(
context,
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 41.rpx, 0.rpx, 0),
child: Container(
height: 80.rpx,
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.circular(12.rpx),
),
child: Align(
alignment:
AlignmentDirectional(-1, 0),
child: TextFormField(
onChanged: (value) {
personController.name.value =
value;
},
autofocus: false,
decoration: InputDecoration(
isDense: true,
hintText: '请输入人员名称'.tr,
hintStyle:
FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(
8.rpx),
),
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: Colors.black,
),
cursorColor:
FlutterFlowTheme.of(context)
.primaryText,
),
),
),
),
'修改人员名称'.tr,
onConfirm: () async {
ApiResponse response =
await personController
.updatePersonName(
widget.device['person'],
widget.device['_id'],
);
if (response.code == HttpStatusCodes.ok) {
bodyDeviceController.getDeviceList();
bodyDeviceController.updateAll();
}
},
onCancel: () {
print('用户点击了取消');
},
);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(width: 24.rpx, height: 24.rpx),
SizedBox(width: 10.rpx),
Text(
"体征检测设备.重命名".tr,
style: TextStyle(
fontSize:
AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
],
),
),
// 删除
ClickableContainer(
padding: EdgeInsets.symmetric(vertical: 16.rpx),
backgroundColor: Colors.transparent,
highlightColor: themeController
.currentColor.sc16
.withOpacity(0.1),
borderRadius: 8.rpx,
onTap: () {
_popupEntry?.remove();
_popupEntry = null;
showConfirmDialog(
context,
Container(),
"是否确认解绑".tr,
onConfirm: () async {
ApiResponse apiResponse =
await bodyDeviceController
.deleteDevice(widget.device);
if (apiResponse.code ==
HttpStatusCodes.ok) {
bodyDeviceController.getDeviceList();
TopSlideNotification.show(
context,
text: apiResponse.msg!,
);
} else {
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor:
themeController.currentColor.sc9,
);
}
},
onCancel: () {},
);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(width: 24.rpx, height: 24.rpx),
SizedBox(width: 10.rpx),
Text(
"体征检测设备.删除".tr,
style: TextStyle(
fontSize:
AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
],
),
),
],
),
),
),
),
)),
],
),
),
);
}
if (widget.device['bind_type'] == BindType.share.code) {
_popupEntry = OverlayEntry(
builder: (context) => GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
_popupEntry?.remove();
_popupEntry = null;
},
child: Stack(
children: [
Positioned(
top: showAbove
? position.dy - popupHeight - paddingOffset
: position.dy + size.height + paddingOffset,
left: position.dx + size.width - popupWidth,
child: Material(
color: Colors.transparent,
child: Container(
width: popupWidth,
padding: EdgeInsets.all(20.rpx),
decoration: BoxDecoration(
color: themeController.currentColor.sc17,
borderRadius: BorderRadius.circular(12.rpx),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.2),
blurRadius: 12.rpx,
spreadRadius: 1.rpx,
offset: Offset(0, 6.rpx),
),
],
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// 首页展示
ClickableContainer(
padding: EdgeInsets.symmetric(vertical: 16.rpx),
backgroundColor: Colors.transparent,
highlightColor: themeController.currentColor.sc16
.withOpacity(0.1),
borderRadius: 8.rpx,
onTap: () async {
ApiResponse apiResponse = await bodyDeviceController
.updateDeviceShow(widget.device);
_popupEntry?.remove();
_popupEntry = null;
if (apiResponse.code == HttpStatusCodes.ok) {
bodyDeviceController.getDeviceList();
bodyDeviceController.updateAll();
} else {
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: themeController.currentColor.sc9,
);
}
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.center, // 这里!行居中
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
if (widget.device['show'] != null &&
widget.device['show'] == true)
SizedBox(
width: 24.rpx,
height: 24.rpx,
child: SvgPicture.asset(
'assets/img/icon/tick.svg',
fit: BoxFit.contain,
color: themeController.currentColor.sc3,
),
),
if (widget.device['show'] == null ||
widget.device['show'] != true)
SizedBox(width: 24.rpx, height: 24.rpx),
SizedBox(width: 10.rpx),
Text(
"体征检测设备.首页展示".tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
],
),
),
// 设备详情
ClickableContainer(
padding: EdgeInsets.symmetric(vertical: 16.rpx),
backgroundColor: Colors.transparent,
highlightColor: themeController.currentColor.sc16
.withOpacity(0.1),
borderRadius: 8.rpx,
onTap: () {
_popupEntry?.remove();
_popupEntry = null;
Get.toNamed("/deviceDetail",
arguments: widget.device);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
// 空占位
SizedBox(width: 24.rpx, height: 24.rpx),
SizedBox(width: 10.rpx),
Text(
"体征检测设备.设备详情".tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
],
),
),
// 重命名
ClickableContainer(
padding: EdgeInsets.symmetric(vertical: 16.rpx),
backgroundColor: Colors.transparent,
highlightColor: themeController.currentColor.sc16
.withOpacity(0.1),
borderRadius: 8.rpx,
onTap: () {
_popupEntry?.remove();
_popupEntry = null;
personController.currentPersonId.value =
widget.device['_id'];
personController.name.value = "";
showConfirmDialog(
context,
Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 41.rpx, 0.rpx, 0),
child: Container(
height: 80.rpx,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(12.rpx),
),
child: Align(
alignment: AlignmentDirectional(-1, 0),
child: TextFormField(
onChanged: (value) {
personController.name.value = value;
},
autofocus: false,
decoration: InputDecoration(
isDense: true,
hintText: '请输入人员名称'.tr,
hintStyle: FlutterFlowTheme.of(context)
.labelMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController
.currentColor.sc4,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Color(0x00000000),
width: 1.rpx,
),
borderRadius:
BorderRadius.circular(8.rpx),
),
),
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: Colors.black,
),
cursorColor: FlutterFlowTheme.of(context)
.primaryText,
),
),
),
),
'修改人员名称'.tr,
onConfirm: () async {
ApiResponse response =
await personController.updatePersonName(
widget.device['person'],
widget.device['_id'],
);
if (response.code == HttpStatusCodes.ok) {
bodyDeviceController.getDeviceList();
bodyDeviceController.updateAll();
}
},
onCancel: () {
print('用户点击了取消');
},
);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(width: 24.rpx, height: 24.rpx),
SizedBox(width: 10.rpx),
Text(
"体征检测设备.重命名".tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
],
),
),
// 删除
ClickableContainer(
padding: EdgeInsets.symmetric(vertical: 16.rpx),
backgroundColor: Colors.transparent,
highlightColor: themeController.currentColor.sc16
.withOpacity(0.1),
borderRadius: 8.rpx,
onTap: () {
_popupEntry?.remove();
_popupEntry = null;
showConfirmDialog(
context,
Container(),
"是否确认解绑".tr,
onConfirm: () async {
ApiResponse apiResponse =
await bodyDeviceController
.deleteDevice(widget.device);
if (apiResponse.code == HttpStatusCodes.ok) {
bodyDeviceController.getDeviceList();
TopSlideNotification.show(
context,
text: apiResponse.msg!,
);
} else {
TopSlideNotification.show(
context,
text: apiResponse.msg!,
textColor: themeController.currentColor.sc9,
);
}
},
onCancel: () {},
);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(width: 24.rpx, height: 24.rpx),
SizedBox(width: 10.rpx),
Text(
"体征检测设备.删除".tr,
style: TextStyle(
fontSize: AppConstants().normal_text_fontSize,
color: themeController.currentColor.sc3,
),
),
],
),
),
],
),
),
),
),
],
),
),
);
}
Overlay.of(context)?.insert(_popupEntry!);
}
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
decoration: BoxDecoration(
color: themeController.currentColor.sc5,
borderRadius: BorderRadius.circular(20.rpx),
),
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(30.rpx, 30.rpx, 30.rpx, 30.rpx),
child: Container(
width: double.infinity,
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
// 'TH689564522DL',
'${widget.device['person']['name'] ?? '未命名'.tr}',
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: 30.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
),
ClickableContainer(
key: _arrowKey,
padding: EdgeInsetsDirectional.fromSTEB(
16.rpx, 16.rpx, 14.rpx, 16.rpx),
backgroundColor: Colors.transparent,
highlightColor: Colors.black.withOpacity(0.1),
borderRadius: 8.rpx,
onTap: _showPopup,
child: Container(
width: 15.rpx,
height: 8.rpx,
child: SvgPicture.asset(
'assets/img/icon/arrow_down.svg',
fit: BoxFit.cover,
color: Colors.white,
),
),
),
],
),
SizedBox(height: 40.rpx),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 100.rpx,
constraints: BoxConstraints(
minWidth: 105.rpx,
),
decoration: BoxDecoration(),
child: Text(
'设备ID'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
),
),
Text(
'${widget.device['_id']}',
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
),
].divide(SizedBox(width: 34.rpx)),
),
SizedBox(height: 40.rpx),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 100.rpx,
constraints: BoxConstraints(
minWidth: 105.rpx,
),
decoration: BoxDecoration(),
child: Text(
'更新时间'.tr,
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
),
),
Text(
'${widget.device['update_time'] != null ? MyUtils.formatDateTime(widget.device['update_time']) : '未知时间'.tr}',
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
),
].divide(SizedBox(width: 34.rpx)),
),
SizedBox(height: 40.rpx),
if (widget.device['bind_type'] == BindType.active.code)
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 100.rpx,
constraints: BoxConstraints(
minWidth: 105.rpx,
),
decoration: BoxDecoration(),
child: Text(
'已分享'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
),
),
Text(
'${widget.device['shareNum']}' + "".tr,
style:
FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc3,
),
),
].divide(SizedBox(width: 34.rpx)),
),
// Icon(
// Icons.arrow_back,
// color: FlutterFlowTheme.of(context).primaryText,
// size: 24.rpx,
// ),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 14.rpx, 0),
child: Container(
width: 28.rpx,
height: 28.rpx,
// width: double.infinity,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/group.svg',
fit: BoxFit.cover,
// color: stringToColor("#333333"), //固定
color: Colors.white,
),
),
),
].divide(SizedBox(width: 34.rpx)),
),
if (widget.device['bind_type'] == BindType.share.code)
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 100.rpx,
constraints: BoxConstraints(
minWidth: 105.rpx,
),
decoration: BoxDecoration(),
child: Text(
'设备来源'.tr,
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
),
),
Text(
'张三',
style:
FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
),
].divide(SizedBox(width: 34.rpx)),
),
// Icon(
// Icons.arrow_back,
// color: FlutterFlowTheme.of(context).primaryText,
// size: 24.rpx,
// ),
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 14.rpx, 0),
child: Container(
width: 28.rpx,
height: 28.rpx,
// width: double.infinity,
decoration: BoxDecoration(),
// child: SvgPicture.asset(
// 'assets/img/icon/group.svg',
// fit: BoxFit.cover,
// color: Colors.white,
// // color: stringToColor("#333333"), //固定
// ),
child: Text(
"云关爱".tr,
style: TextStyle(
color: themeController.currentColor.sc4,
fontSize: AppConstants().normal_text_fontSize,
),
),
),
),
].divide(SizedBox(width: 34.rpx)),
),
SizedBox(height: 40.rpx),
Row(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 100.rpx,
constraints: BoxConstraints(
minWidth: 105.rpx,
),
decoration: BoxDecoration(),
child: Text(
'设备状态',
style: FlutterFlowTheme.of(context).bodyMedium.override(
fontFamily: 'Inter',
fontSize: 26.rpx,
letterSpacing: 0.0,
color: themeController.currentColor.sc4,
),
),
),
Row(
mainAxisSize: MainAxisSize.max,
children: [
if (widget.device['status']['wifi'] != null &&
widget.device['status']['wifi'] != -1)
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 0),
child: Container(
width: 25.rpx,
height: 25.rpx,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/signal${widget.device['status']['wifi']}.svg',
fit: BoxFit.fill,
),
),
),
Padding(
padding: EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 0),
child: Container(
width: 16.rpx,
height: 36.rpx,
// width: double.infinity,
decoration: BoxDecoration(),
child: widget.device['status']['inBed'] == 0
? SvgPicture.asset(
'assets/img/icon/not_bed.svg',
fit: BoxFit.fill,
)
: SvgPicture.asset(
'assets/img/icon/in_bed.svg',
fit: BoxFit.fill,
),
),
),
if (widget.device['status']['failure'] != 0)
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 0),
child: Container(
width: 27.rpx,
height: 27.rpx,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/device_issue.svg',
fit: BoxFit.cover,
),
),
),
if (widget.device['status']['upgrade'] != 0)
Padding(
padding:
EdgeInsetsDirectional.fromSTEB(0, 0.rpx, 0, 0),
child: Container(
width: 34.rpx,
height: 24.rpx,
decoration: BoxDecoration(),
child: SvgPicture.asset(
'assets/img/icon/upgrade.svg',
fit: BoxFit.cover,
// color: themeController.currentColor.sc3, //固定
),
),
),
//todo 缺少一个设备离线的图标
].divide(SizedBox(width: 50.rpx)),
),
].divide(SizedBox(width: 34.rpx)),
),
Divider(
thickness: 2,
color: themeController.currentColor.sc4,
),
SizedBox(height: 5.rpx),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
CustomCard(
borderRadius: AppConstants().button_container_radius,
onTap: () {
// 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.selectedDiseaseIds.value =
widget.device['person']['disease'] ?? [];
personController.birthday.value =
widget.device['person']['birthday'] ?? '';
personController.dateTime = MyUtils.formatBirthdayTime(
widget.device['person']['birthday']);
}
// Get.toNamed("/personPage");
Get.toNamed("/updatePersonPage");
},
colors: [
themeController.currentColor.sc1,
themeController.currentColor.sc2,
],
child: Padding(
padding: EdgeInsetsDirectional.fromSTEB(
0.rpx, 0.rpx, 0.rpx, 0.rpx),
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,
crossAxisAlignment: CrossAxisAlignment.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: () {
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,
),
),
].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)),
),
),
),
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,
),
),
].divide(SizedBox(width: 17.rpx)),
),
),
),
],
),
].divide(SizedBox(height: 0.rpx)),
),
),
),
);
}
}