更新
This commit is contained in:
@@ -4,7 +4,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/base/SleepCalendarWidget.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/device/device_calibration_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
|
||||
getOnePicker(context, List arr, int checkIndex, Function onSelectedItemChanged,
|
||||
@@ -789,7 +791,7 @@ void showProgressDialog(
|
||||
ValueNotifier<bool> failureNotifier,
|
||||
) {
|
||||
ThemeController themeController = Get.find();
|
||||
|
||||
DeviceCalibrationController deviceCalibrationController = Get.find();
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false, // 点击对话框外部不可关闭
|
||||
@@ -826,23 +828,28 @@ void showProgressDialog(
|
||||
if (Navigator.canPop(dialogContext)) {
|
||||
Navigator.of(dialogContext).pop();
|
||||
}
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "设备校准失败".tr,
|
||||
textColor: Colors.red,
|
||||
);
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "设备校准失败".tr,
|
||||
// textColor: Colors.red,
|
||||
// );
|
||||
});
|
||||
} else if (progress >= 1.0) {
|
||||
} else if (progress >= 100) {
|
||||
// 延迟关闭弹窗和提示成功(可选)
|
||||
Future.delayed(Duration(milliseconds: 300), () {
|
||||
if (Navigator.canPop(dialogContext)) {
|
||||
Navigator.of(dialogContext).pop();
|
||||
}
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "设备校准完成".tr,
|
||||
textColor: themeController.currentColor.sc3,
|
||||
);
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "设备校准完成".tr,
|
||||
// );
|
||||
// Obx(() {
|
||||
// TopSlideNotification.show(context,
|
||||
// text:
|
||||
// deviceCalibrationController.tips.value);
|
||||
// return Container();
|
||||
// });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -852,7 +859,7 @@ void showProgressDialog(
|
||||
Text(
|
||||
isFailure
|
||||
? '失败'.tr
|
||||
: '${(progress * 100).toStringAsFixed(0)}%',
|
||||
: '${(progress).toStringAsFixed(0)}%',
|
||||
style: TextStyle(
|
||||
fontSize: 26.rpx,
|
||||
color: isFailure
|
||||
@@ -877,22 +884,23 @@ void showProgressDialog(
|
||||
width: progress *
|
||||
MediaQuery.of(context).size.width *
|
||||
0.8,
|
||||
height: 10.rpx,
|
||||
height: 21.rpx,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: isFailure
|
||||
? [themeController.currentColor.sc9]
|
||||
: [
|
||||
themeController
|
||||
.currentColor.sc1,
|
||||
.currentColor.sc2,
|
||||
themeController
|
||||
.currentColor.sc2,
|
||||
],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
),
|
||||
borderRadius:
|
||||
BorderRadius.circular(5.rpx),
|
||||
borderRadius: BorderRadius.circular(
|
||||
AppConstants().button_container_radius,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -912,3 +920,30 @@ void showProgressDialog(
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void showSleepCalendarBottomSheet({
|
||||
required BuildContext context,
|
||||
int? timestamp,
|
||||
required void Function(DateTime selectedDate) onDateSelected,
|
||||
}) {
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: false,
|
||||
backgroundColor: Colors.transparent,
|
||||
builder: (context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xFF242835),
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20.rpx),
|
||||
topRight: Radius.circular(20.rpx),
|
||||
),
|
||||
),
|
||||
child: SleepCalendarWidget(
|
||||
timestamp: timestamp,
|
||||
onDateSelected: onDateSelected, // 传递回调下去
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -536,9 +536,8 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
cursorColor:
|
||||
FlutterFlowTheme.of(context)
|
||||
.primaryText,
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -602,6 +601,7 @@ class _BodyDevicePageState extends State<BodyDeviceWidget> {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Obx(() {
|
||||
final isEmpty =
|
||||
bodyDeviceController.deviceList.value.isEmpty;
|
||||
|
||||
@@ -73,6 +73,7 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
final allTexts = [
|
||||
"体征检测设备.首页展示".tr,
|
||||
"体征检测设备.设备详情".tr,
|
||||
"WIFI配置".tr,
|
||||
"设备校准".tr,
|
||||
"分享设备".tr,
|
||||
"消息设置".tr,
|
||||
@@ -86,7 +87,7 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
final estimatedItemHeight = 60.rpx; // 每个菜单项的估算高度
|
||||
//todo 更新菜单项,需要在此添加数量
|
||||
final itemCount =
|
||||
widget.device['bind_type'] == BindType.active.code ? 8 : 5;
|
||||
widget.device['bind_type'] == BindType.active.code ? 9 : 5;
|
||||
final estimatedPopupHeight =
|
||||
(itemCount * estimatedItemHeight) + 40.rpx; // 加上padding
|
||||
|
||||
@@ -140,12 +141,24 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
left: popupLeft,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: ConstrainedBox(
|
||||
child: Container(
|
||||
constraints: BoxConstraints(
|
||||
// maxWidth: popupWidth,
|
||||
maxWidth: screenWidth,
|
||||
maxHeight: actualPopupHeight,
|
||||
),
|
||||
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: SingleChildScrollView(
|
||||
child: popupContent,
|
||||
),
|
||||
@@ -164,18 +177,18 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
Widget _buildPopupContent() {
|
||||
final content = 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),
|
||||
),
|
||||
],
|
||||
),
|
||||
// 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: _buildMenuItems(),
|
||||
@@ -250,6 +263,14 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
// dealWifi(widget.device['mac']);
|
||||
// },
|
||||
// ),
|
||||
_buildMenuItem(
|
||||
text: "WIFI配置".tr,
|
||||
onTap: () {
|
||||
_popupEntry?.remove();
|
||||
_popupEntry = null;
|
||||
dealWifi(widget.device['mac']);
|
||||
},
|
||||
),
|
||||
_buildMenuItem(
|
||||
text: "设备校准".tr,
|
||||
onTap: () {
|
||||
@@ -962,7 +983,6 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
personController.currentPersonId.value =
|
||||
widget.device['_id'];
|
||||
}
|
||||
// Get.toNamed("/personPage");
|
||||
await Get.toNamed("/updatePersonPage",
|
||||
arguments: widget.device['bind_type']);
|
||||
bodyDeviceController.getDeviceList();
|
||||
@@ -1151,7 +1171,7 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
final themeController = Get.find<ThemeController>();
|
||||
|
||||
// 显示加载对话框
|
||||
showLoadingDialog(Get.context!, title: "正在匹配设备...".tr);
|
||||
showLoadingDialog(Get.context!, title: "连接中...".tr);
|
||||
|
||||
// 设置超时定时器
|
||||
Timer? timeoutTimer;
|
||||
@@ -1204,26 +1224,27 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
|
||||
try {
|
||||
// 连接设备
|
||||
await targetDevice.device.connect(autoConnect: false);
|
||||
|
||||
// 检查连接状态
|
||||
if (targetDevice.device.isConnected) {
|
||||
Navigator.of(Get.context!).pop(); // 关闭加载对话框
|
||||
|
||||
// 存储当前设备
|
||||
blueteethBindController.currentDevice =
|
||||
THapp(device: targetDevice.device);
|
||||
|
||||
// 跳转到WiFi配置页
|
||||
Get.toNamed("/wifiPage");
|
||||
|
||||
// await targetDevice.device.connect();
|
||||
THapp bledevice = THapp(device: targetDevice.device);
|
||||
await bledevice.device.connect();
|
||||
var res2 = bledevice.isConnected;
|
||||
if (res2) {
|
||||
Navigator.pop(context);
|
||||
TopSlideNotification.show(
|
||||
Get.context!,
|
||||
text: "设备连接成功".tr,
|
||||
context,
|
||||
text: "蓝牙绑定.连接成功".tr,
|
||||
textColor: themeController.currentColor.sc2,
|
||||
);
|
||||
blueteethBindController.currentDevice = bledevice;
|
||||
// Get.toNamed("/wifiPage", arguments: {bledevice});
|
||||
Get.toNamed("/wifiPage", arguments: 1);
|
||||
} else {
|
||||
throw Exception("连接失败");
|
||||
Navigator.pop(context);
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "蓝牙绑定.连接失败".tr,
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
Navigator.of(Get.context!).pop(); // 关闭加载对话框
|
||||
@@ -1235,7 +1256,6 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// 等待扫描完成
|
||||
await Future.delayed(Duration(seconds: 20));
|
||||
} catch (e) {
|
||||
@@ -1264,8 +1284,6 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
maxTextWidth = painter.width;
|
||||
}
|
||||
}
|
||||
|
||||
// 加上 icon 宽度(24.rpx),间距(10.rpx),padding(左右 20.rpx)
|
||||
final iconWidth = 24.rpx;
|
||||
final spacing = 10.rpx;
|
||||
final horizontalPadding = 40.rpx;
|
||||
|
||||
@@ -278,14 +278,21 @@ class _DeviceDetailPageState extends State<DeviceDetailPage> {
|
||||
minHeight: 200.rpx,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: FlutterFlowTheme.of(context)
|
||||
.secondaryBackground,
|
||||
),
|
||||
child: QrImageView(
|
||||
data: '1234567890',
|
||||
version: QrVersions.auto,
|
||||
size: 200.0.rpx,
|
||||
color: Colors.transparent,
|
||||
),
|
||||
child: (widget.device['code']
|
||||
?.toString()
|
||||
.isNotEmpty ??
|
||||
false)
|
||||
? QrImageView(
|
||||
data: widget.device['code'].toString(),
|
||||
version: QrVersions.auto,
|
||||
size: 200.0.rpx,
|
||||
)
|
||||
: Image.asset(
|
||||
"assets/img/errorImg.jpeg",
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: 50.rpx,
|
||||
@@ -293,7 +300,11 @@ class _DeviceDetailPageState extends State<DeviceDetailPage> {
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional(-1.rpx, 0.rpx),
|
||||
child: Text(
|
||||
'A35968956',
|
||||
(widget.device['code'] ?? '')
|
||||
.toString()
|
||||
.isNotEmpty
|
||||
? widget.device['code'].toString()
|
||||
: '未知数据'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
|
||||
@@ -34,14 +34,22 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
|
||||
DeviceTypeController deviceTypeController = Get.find();
|
||||
|
||||
int maxBodyMotion = 1;
|
||||
String breathState = "否";
|
||||
String inBed = "离床".tr;
|
||||
// String breathState = "否";
|
||||
// String inBed = "离床".tr;
|
||||
// String onlineState = "离线".tr;
|
||||
// Timer? _onlineTimer; // 添加 Timer 引用
|
||||
// int bodyMotion = 0;
|
||||
// int breathrate = 0;
|
||||
// String snores = "否".tr;
|
||||
// int heartrate = 0;
|
||||
String breathState = "未知数据".tr;
|
||||
String inBed = "未知数据".tr;
|
||||
String onlineState = "离线".tr;
|
||||
Timer? _onlineTimer; // 添加 Timer 引用
|
||||
int bodyMotion = 0;
|
||||
int breathrate = 0;
|
||||
String snores = "否".tr;
|
||||
int heartrate = 0;
|
||||
int bodyMotion = -1;
|
||||
int breathrate = -1;
|
||||
String snores = "未知数据".tr;
|
||||
int heartrate = -1;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -67,6 +75,12 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
onlineState = "离线".tr; // 30 秒内没有接收到数据,设置为离线
|
||||
inBed = "未知数据".tr;
|
||||
bodyMotion = -1;
|
||||
heartrate = -1;
|
||||
snores = "未知数据".tr;
|
||||
breathrate = -1;
|
||||
breathState = "未知数据".tr;
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -162,338 +176,357 @@ class _InstantBodyPageState extends State<InstantBodyPage> {
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0.rpx, 29.rpx, 0.rpx, 0.rpx),
|
||||
child: SingleChildScrollView(
|
||||
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)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
66.rpx, 0, 66.rpx, 0),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
'assets/img/body_black.gif'), // 本地图片
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
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: [
|
||||
DeviceStatusInfoWidget(
|
||||
title: "在离床".tr,
|
||||
iconAsset: "assets/img/icon/bed_status.svg",
|
||||
value: inBed,
|
||||
),
|
||||
DeviceStatusInfoWidget(
|
||||
title: "体动".tr,
|
||||
iconAsset: "assets/img/icon/bodymotion.svg",
|
||||
value: "${bodyMotion}" ?? "未知数据".tr,
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
DeviceStatusInfoWidget(
|
||||
title: "心率".tr,
|
||||
iconAsset: "assets/img/icon/heart.svg",
|
||||
value: "${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}',
|
||||
),
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
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, // 边框颜色
|
||||
width: 2.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.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'实时体征.提示'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
letterSpacing: 0.0,
|
||||
color: themeController.currentColor.sc4,
|
||||
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)),
|
||||
),
|
||||
].divide(SizedBox(width: 23.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)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 26.rpx,
|
||||
),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
66.rpx, 0, 66.rpx, 0),
|
||||
child: Container(
|
||||
// decoration: BoxDecoration(
|
||||
// image: DecorationImage(
|
||||
// image: AssetImage(
|
||||
// 'assets/img/body_black.gif'), // 本地图片
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
// ),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
onlineState == "离线".tr
|
||||
? 'assets/img/black_body_still.jpg' // 静态图
|
||||
: '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)),
|
||||
),
|
||||
),
|
||||
),
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// 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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -7,7 +7,9 @@ import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/device/body_device_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/person/person_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
|
||||
@@ -176,9 +178,34 @@ class _EPageState extends State<BindDeviceSuccess> {
|
||||
child: CustomCard(
|
||||
borderRadius:
|
||||
AppConstants().button_container_radius, // 圆角半径
|
||||
onTap: () {
|
||||
print('Button pressed ...');
|
||||
Get.toNamed("/deviceType");
|
||||
onTap: () async {
|
||||
PersonController personController = Get.find();
|
||||
String deviceID =
|
||||
personController.currentPersonId.value;
|
||||
|
||||
BodyDeviceController bodyDeviceController =
|
||||
Get.find();
|
||||
await bodyDeviceController.getDeviceList();
|
||||
List deviceList =
|
||||
bodyDeviceController.deviceList.value;
|
||||
|
||||
if (deviceList != null && deviceList.isNotEmpty) {
|
||||
// 查找第一个 _id 匹配的设备
|
||||
final matchedDevice = deviceList.firstWhere(
|
||||
(element) => element['_id'] == deviceID,
|
||||
orElse: () => null,
|
||||
);
|
||||
|
||||
if (matchedDevice != null) {
|
||||
// 跳转并传入设备
|
||||
Get.toNamed("/deviceSharePage",
|
||||
arguments: matchedDevice);
|
||||
} else {
|
||||
print("未找到匹配的设备");
|
||||
}
|
||||
} else {
|
||||
print("设备列表为空");
|
||||
}
|
||||
},
|
||||
colors: [
|
||||
// 渐变色
|
||||
|
||||
@@ -494,9 +494,8 @@ class _BlueteethDevicePageState extends State<BlueteethDevicePage> {
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
cursorColor:
|
||||
FlutterFlowTheme.of(context)
|
||||
.primaryText,
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
// validator: _model
|
||||
// .textControllerValidator
|
||||
// .asValidator(context),
|
||||
|
||||
@@ -69,7 +69,7 @@ class _FancyCircleCheckboxState extends State<FancyCircleCheckbox>
|
||||
color: widget.value
|
||||
? widget.borderColor
|
||||
: widget.borderColor.withOpacity(0.5),
|
||||
width: 1,
|
||||
width: 1.rpx,
|
||||
),
|
||||
),
|
||||
child: ScaleTransition(
|
||||
|
||||
0
lib/pages/device_bind/componnet/wechat_share.dart
Normal file
0
lib/pages/device_bind/componnet/wechat_share.dart
Normal file
@@ -15,6 +15,7 @@ import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/device/device_calibration_controller.dart';
|
||||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||||
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||
|
||||
class CalibrationPage extends StatefulWidget {
|
||||
int? type; //1.绑定时 2.绑定后
|
||||
@@ -26,16 +27,21 @@ class CalibrationPage extends StatefulWidget {
|
||||
|
||||
class _CalibrationPageState extends State<CalibrationPage> {
|
||||
DeviceCalibrationController deviceCalibrationController = Get.find();
|
||||
BlueteethBindController blueteethBindController = Get.find();
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
deviceCalibrationController.process.value = 0;
|
||||
deviceCalibrationController.bed_calibration.value = 0;
|
||||
deviceCalibrationController.position_calibration.value = 0;
|
||||
blueteethBindController.cid!.value = "";
|
||||
deviceCalibrationController.complete = false;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
blueteethBindController.cid!.value = "";
|
||||
deviceCalibrationController.complete = false;
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -144,8 +150,8 @@ class _CalibrationPageState extends State<CalibrationPage> {
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.rpx), // 可自定义内边距
|
||||
onTap: () {
|
||||
deviceCalibrationController.process.value = 0;
|
||||
deviceCalibrationController.updateAll();
|
||||
// deviceCalibrationController.process.value = 0;
|
||||
// deviceCalibrationController.updateAll();
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
@@ -213,8 +219,8 @@ class _CalibrationPageState extends State<CalibrationPage> {
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 10.rpx), // 可根据需要调整上下内边距
|
||||
onTap: () {
|
||||
deviceCalibrationController.process.value = 1;
|
||||
deviceCalibrationController.updateAll();
|
||||
// deviceCalibrationController.process.value = 1;
|
||||
// deviceCalibrationController.updateAll();
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
@@ -483,56 +489,221 @@ class _CalibrationPageState extends State<CalibrationPage> {
|
||||
child: CustomCard(
|
||||
borderRadius:
|
||||
AppConstants().button_container_radius, // 圆角半径
|
||||
// onTap: () async {
|
||||
// BlueteethBindController blueteethBindController =
|
||||
// Get.find();
|
||||
// String serviceAddress = "http://192.168.1.80:8086";
|
||||
// String serviceApi = ServiceConstant.start_calibration;
|
||||
// String queryUrl = "${serviceAddress}${serviceApi}";
|
||||
// requestWithLog(
|
||||
// logTitle: "设备校准",
|
||||
// method: MyHttpMethod.post,
|
||||
// queryUrl: queryUrl,
|
||||
// data: {
|
||||
// "macA": blueteethBindController.currentDeviceMac,
|
||||
// if (blueteethBindController.cid!.value.isNotEmpty)
|
||||
// "id": blueteethBindController.cid!.value,
|
||||
// },
|
||||
// onSuccess: (res) {
|
||||
// String cid = res.rawResponse.data['cid'];
|
||||
// blueteethBindController.cid!.value = cid;
|
||||
// final ValueNotifier<double> progressNotifier =
|
||||
// ValueNotifier<double>(0.0);
|
||||
// final ValueNotifier<bool> failureNotifier =
|
||||
// ValueNotifier<bool>(false);
|
||||
// Timer? pollingTimer;
|
||||
// // 定义请求函数
|
||||
// void requestCalibrationProgress() {
|
||||
// String serviceAddress =
|
||||
// "http://192.168.1.80:8086";
|
||||
// String serviceApi =
|
||||
// ServiceConstant.calibration_process;
|
||||
// String queryUrl =
|
||||
// "${serviceAddress}${serviceApi}?id=$cid";
|
||||
// requestWithLog(
|
||||
// logTitle: "设备校准进度",
|
||||
// method: MyHttpMethod.get,
|
||||
// queryUrl: queryUrl,
|
||||
// onSuccess: (res) {
|
||||
// print(res);
|
||||
// deviceCalibrationController.tips.value =
|
||||
// res.data['statusText'];
|
||||
// if (res.data['per'] == 100) {
|
||||
// TopSlideNotification.show(context,
|
||||
// text: deviceCalibrationController
|
||||
// .tips.value);
|
||||
// }
|
||||
// double process =
|
||||
// (res.data['per'] ?? 0).toDouble();
|
||||
// progressNotifier.value = process;
|
||||
// if (process >= 100) {
|
||||
// if (deviceCalibrationController
|
||||
// .process.value ==
|
||||
// 0) {
|
||||
// deviceCalibrationController
|
||||
// .bed_calibration.value = 1;
|
||||
// deviceCalibrationController.updateAll();
|
||||
// }
|
||||
// if (deviceCalibrationController
|
||||
// .process.value ==
|
||||
// 1) {
|
||||
// deviceCalibrationController
|
||||
// .position_calibration.value = 1;
|
||||
// deviceCalibrationController.updateAll();
|
||||
// }
|
||||
// deviceCalibrationController
|
||||
// .process.value = 1;
|
||||
// deviceCalibrationController.updateAll();
|
||||
// pollingTimer?.cancel();
|
||||
// }
|
||||
// },
|
||||
// onFailure: (res) {
|
||||
// pollingTimer?.cancel();
|
||||
// failureNotifier.value = true;
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: res.msg ?? "服务器.失败".tr,
|
||||
// textColor:
|
||||
// themeController.currentColor.sc9,
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// }
|
||||
|
||||
// // 启动轮询
|
||||
// pollingTimer =
|
||||
// Timer.periodic(Duration(seconds: 2), (timer) {
|
||||
// requestCalibrationProgress();
|
||||
// });
|
||||
|
||||
// // 初始调用一次
|
||||
// requestCalibrationProgress();
|
||||
|
||||
// // 显示进度弹窗
|
||||
// showProgressDialog(
|
||||
// context, progressNotifier, failureNotifier);
|
||||
// },
|
||||
// onFailure: (res) {
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: res.msg ?? "服务器.失败".tr,
|
||||
// textColor: themeController.currentColor.sc9,
|
||||
// );
|
||||
// },
|
||||
// );
|
||||
// },
|
||||
|
||||
onTap: () async {
|
||||
if (deviceCalibrationController.complete) {
|
||||
showConfirmDialog(
|
||||
context, Container(), "校准已经完成,是否重新开始校准?",
|
||||
onConfirm: () {
|
||||
BlueteethBindController blueteethBindController =
|
||||
Get.find();
|
||||
deviceCalibrationController.process.value = 0;
|
||||
deviceCalibrationController
|
||||
.bed_calibration.value = 0;
|
||||
deviceCalibrationController
|
||||
.position_calibration.value = 0;
|
||||
blueteethBindController.cid!.value = "";
|
||||
deviceCalibrationController.complete = false;
|
||||
}, onCancel: () {});
|
||||
}
|
||||
|
||||
BlueteethBindController blueteethBindController =
|
||||
Get.find();
|
||||
String serviceAddress = "https://caibration.he-info.cn/";
|
||||
String calibrationApi =
|
||||
ServiceConstant.start_calibration;
|
||||
String progressApi =
|
||||
ServiceConstant.calibration_process;
|
||||
|
||||
String queryUrl = "$serviceAddress$calibrationApi";
|
||||
|
||||
final ValueNotifier<double> progressNotifier =
|
||||
ValueNotifier<double>(0.0);
|
||||
final ValueNotifier<bool> failureNotifier =
|
||||
ValueNotifier<bool>(false);
|
||||
Timer? pollingTimer;
|
||||
|
||||
Map<String, dynamic> data = {
|
||||
"macA": blueteethBindController.currentDeviceMac,
|
||||
};
|
||||
|
||||
// 是否是二次点击(有cid表示进行第二阶段)
|
||||
bool isSecondStep =
|
||||
blueteethBindController.cid?.value.isNotEmpty ??
|
||||
false;
|
||||
|
||||
if (isSecondStep) {
|
||||
data["id"] = blueteethBindController.cid!.value;
|
||||
}
|
||||
|
||||
// 发起校准请求
|
||||
requestWithLog(
|
||||
logTitle: "设备校准",
|
||||
method: MyHttpMethod.post,
|
||||
queryUrl: ServiceConstant.start_calibration,
|
||||
data: {
|
||||
"deviceId":
|
||||
blueteethBindController.currentDeviceMac
|
||||
},
|
||||
queryUrl: queryUrl,
|
||||
data: data,
|
||||
onSuccess: (res) {
|
||||
final ValueNotifier<double> progressNotifier =
|
||||
ValueNotifier<double>(0.0);
|
||||
final ValueNotifier<bool> failureNotifier =
|
||||
ValueNotifier<bool>(false);
|
||||
Timer? pollingTimer;
|
||||
if (!isSecondStep) {
|
||||
// 保存第一次获取的 cid
|
||||
String cid = res.rawResponse.data['cid'];
|
||||
blueteethBindController.cid!.value = cid;
|
||||
}
|
||||
|
||||
// 定义请求函数
|
||||
void requestCalibrationProgress() {
|
||||
String cid = blueteethBindController.cid!.value;
|
||||
String progressUrl =
|
||||
"$serviceAddress$progressApi?id=$cid";
|
||||
requestWithLog(
|
||||
logTitle: "设备校准进度",
|
||||
method: MyHttpMethod.post,
|
||||
queryUrl: ServiceConstant.calibration_process,
|
||||
data: {
|
||||
"deviceId":
|
||||
blueteethBindController.currentDeviceMac
|
||||
},
|
||||
method: MyHttpMethod.get,
|
||||
queryUrl: progressUrl,
|
||||
onSuccess: (res) {
|
||||
double process =
|
||||
(res.data['process'] ?? 0).toDouble();
|
||||
progressNotifier.value = process;
|
||||
final data = res.data;
|
||||
double per = (data['per'] ?? 0).toDouble();
|
||||
int currStep = data['currStep'] ?? -1;
|
||||
bool status = data['status'] ?? false;
|
||||
String tips = data['statusText'] ?? '';
|
||||
|
||||
if (process >= 100) {
|
||||
if (deviceCalibrationController
|
||||
.process.value ==
|
||||
0) {
|
||||
deviceCalibrationController
|
||||
.bed_calibration.value = 1;
|
||||
deviceCalibrationController.updateAll();
|
||||
}
|
||||
if (deviceCalibrationController
|
||||
.process.value ==
|
||||
1) {
|
||||
deviceCalibrationController
|
||||
.position_calibration.value = 1;
|
||||
deviceCalibrationController.updateAll();
|
||||
}
|
||||
deviceCalibrationController.tips.value =
|
||||
tips;
|
||||
// progressNotifier.value =
|
||||
// (res.data['per'] ?? 0) / 100.0;
|
||||
progressNotifier.value = per;
|
||||
|
||||
if (!isSecondStep && per >= 100) {
|
||||
// 第一步完成:仅 per >= 100
|
||||
pollingTimer?.cancel();
|
||||
TopSlideNotification.show(context,
|
||||
text: tips);
|
||||
deviceCalibrationController
|
||||
.process.value = 1;
|
||||
deviceCalibrationController
|
||||
.bed_calibration.value = 1;
|
||||
|
||||
deviceCalibrationController.updateAll();
|
||||
}
|
||||
|
||||
if (isSecondStep &&
|
||||
per >= 100 &&
|
||||
currStep == 5 &&
|
||||
status == true) {
|
||||
// 第二步完成:per >= 100 && currStep == 5 && status == true
|
||||
pollingTimer?.cancel();
|
||||
TopSlideNotification.show(context,
|
||||
text: "设备校准完成".tr);
|
||||
// 可在这里执行校准完成后的业务逻辑更新
|
||||
deviceCalibrationController
|
||||
.bed_calibration.value = 1;
|
||||
deviceCalibrationController
|
||||
.position_calibration.value = 1;
|
||||
deviceCalibrationController
|
||||
.process.value = 1;
|
||||
deviceCalibrationController.complete =
|
||||
true;
|
||||
deviceCalibrationController.updateAll();
|
||||
}
|
||||
},
|
||||
onFailure: (res) {
|
||||
@@ -548,15 +719,15 @@ class _CalibrationPageState extends State<CalibrationPage> {
|
||||
);
|
||||
}
|
||||
|
||||
// 启动轮询
|
||||
pollingTimer =
|
||||
Timer.periodic(Duration(seconds: 2), (timer) {
|
||||
requestCalibrationProgress();
|
||||
});
|
||||
|
||||
// 初始调用一次
|
||||
requestCalibrationProgress();
|
||||
|
||||
// 开始轮询
|
||||
pollingTimer =
|
||||
Timer.periodic(Duration(seconds: 2), (_) {
|
||||
requestCalibrationProgress();
|
||||
});
|
||||
|
||||
// 显示进度弹窗
|
||||
showProgressDialog(
|
||||
context, progressNotifier, failureNotifier);
|
||||
@@ -570,6 +741,7 @@ class _CalibrationPageState extends State<CalibrationPage> {
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
colors: [
|
||||
themeController.currentColor.sc1,
|
||||
themeController.currentColor.sc2,
|
||||
|
||||
@@ -207,9 +207,8 @@ class _DeviceShareListPageState extends State<DeviceShareListPage> {
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
cursorColor:
|
||||
FlutterFlowTheme.of(context)
|
||||
.primaryText,
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:fluwx/fluwx.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';
|
||||
@@ -8,6 +10,7 @@ import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/device/device_share_controller.dart';
|
||||
import 'package:vbvs_app/controller/login/login_controller.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
import 'package:vbvs_app/pages/device_bind/componnet/FancyCircleCheckbox.dart';
|
||||
|
||||
@@ -180,7 +183,9 @@ class _DeviceSharePageState extends State<DeviceSharePage> {
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50.rpx),
|
||||
border: Border.all(
|
||||
color: Color(0xFFF3EDED),
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
@@ -250,8 +255,7 @@ class _DeviceSharePageState extends State<DeviceSharePage> {
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
cursorColor:
|
||||
FlutterFlowTheme.of(context).primaryText,
|
||||
cursorColor: themeController.currentColor.sc3,
|
||||
// validator: _model.textController1Validator
|
||||
// .asValidator(context),
|
||||
),
|
||||
@@ -371,9 +375,15 @@ class _DeviceSharePageState extends State<DeviceSharePage> {
|
||||
child: CustomCard(
|
||||
borderRadius:
|
||||
AppConstants().button_container_radius, // 圆角半径
|
||||
onTap: () {
|
||||
TopSlideNotification.show(context,
|
||||
text: "待开发功能".tr);
|
||||
onTap: () async {
|
||||
// TopSlideNotification.show(context,
|
||||
// text: "待开发功能".tr);
|
||||
LoginController loginController = Get.find();
|
||||
// loginController.fluwx.share(WeChatShareTextModel(
|
||||
// "太和e护分享链接",
|
||||
// scene: WeChatScene.session));
|
||||
final Uint8List data = await rootBundle.load('assets/img/camera.png').then((bd) => bd.buffer.asUint8List());
|
||||
loginController.fluwx.share(WeChatShareWebPageModel("https://www.baidu.com",title: "标题",description: "描述",thumbData: data));
|
||||
},
|
||||
colors: [
|
||||
// 渐变色
|
||||
|
||||
@@ -18,7 +18,8 @@ import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||
|
||||
class WifiPage extends StatefulWidget {
|
||||
WifiPage({super.key});
|
||||
var type;
|
||||
WifiPage({super.key, required this.type});
|
||||
|
||||
@override
|
||||
State<WifiPage> createState() => _WifiPageState();
|
||||
@@ -36,6 +37,8 @@ class _WifiPageState extends State<WifiPage> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
blueteethBindController.wifiList = [].obs;
|
||||
blueteethBindController.wifiStatus = 0.obs;
|
||||
blueteethBindController.connect_wifi.value = {};
|
||||
initWifiStatusAndWifiList();
|
||||
}
|
||||
|
||||
@@ -91,45 +94,45 @@ class _WifiPageState extends State<WifiPage> {
|
||||
left: 0,
|
||||
child: returnIconButtom,
|
||||
),
|
||||
Positioned(
|
||||
right: 20.rpx,
|
||||
child: CustomCard(
|
||||
borderRadius: 20.rpx,
|
||||
onTap: () async {
|
||||
if (blueteethBindController.wifiStatus.value != 1) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "wifi页.需配网".tr,
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
}
|
||||
Get.toNamed("/calibrationPage",arguments: 1);
|
||||
// Get.toNamed("/personPage");
|
||||
// Get.toNamed("/bindDeviceSuccess");
|
||||
},
|
||||
colors: [
|
||||
themeController.currentColor.sc1,
|
||||
themeController.currentColor.sc2,
|
||||
],
|
||||
child: Container(
|
||||
width: 100.rpx,
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
16.rpx, 0, 16.rpx, 0),
|
||||
child: Text(
|
||||
'wifi页.跳过'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.titleSmall
|
||||
.override(
|
||||
fontFamily: 'Inter Tight',
|
||||
color: themeController.currentColor.sc3,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
if (widget.type == null)
|
||||
Positioned(
|
||||
right: 20.rpx,
|
||||
child: CustomCard(
|
||||
borderRadius: 20.rpx,
|
||||
onTap: () async {
|
||||
if (blueteethBindController.wifiStatus.value != 1) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "wifi页.需配网".tr,
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
} else {
|
||||
Get.toNamed("/calibrationPage", arguments: 1);
|
||||
}
|
||||
},
|
||||
colors: [
|
||||
themeController.currentColor.sc1,
|
||||
themeController.currentColor.sc2,
|
||||
],
|
||||
child: Container(
|
||||
width: 100.rpx,
|
||||
height: 60.rpx,
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
16.rpx, 0, 16.rpx, 0),
|
||||
child: Text(
|
||||
'wifi页.跳过'.tr,
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.titleSmall
|
||||
.override(
|
||||
fontFamily: 'Inter Tight',
|
||||
color: themeController.currentColor.sc3,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -207,25 +210,29 @@ class _WifiPageState extends State<WifiPage> {
|
||||
.connect_wifi.value.isEmpty) {
|
||||
return Container();
|
||||
} else {
|
||||
return Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
blueteethBindController
|
||||
.connect_wifi.value['ssid'] ??
|
||||
'未命名'.tr,
|
||||
style: TextStyle(
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
return Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 0.rpx, 30.rpx, 30.rpx),
|
||||
child: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
blueteethBindController.connect_wifi
|
||||
.value['ssid'] ??
|
||||
'未命名'.tr,
|
||||
style: TextStyle(
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
),
|
||||
),
|
||||
),
|
||||
getWifiIconByRsso(
|
||||
blueteethBindController
|
||||
.connect_wifi.value),
|
||||
],
|
||||
getWifiIconByRsso(
|
||||
blueteethBindController
|
||||
.connect_wifi.value),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
})
|
||||
@@ -267,136 +274,6 @@ class _WifiPageState extends State<WifiPage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
// Column(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// children: [
|
||||
// Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment:
|
||||
// MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Text(
|
||||
// '6503',
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Inter',
|
||||
// fontSize: 30.rpx,
|
||||
// letterSpacing: 0.0,
|
||||
// color: themeController
|
||||
// .currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// Icon(
|
||||
// Icons.wifi_outlined,
|
||||
// size: 30.rpx,
|
||||
// color: themeController
|
||||
// .currentColor.sc3,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment:
|
||||
// MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Text(
|
||||
// '6503',
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Inter',
|
||||
// fontSize: 30.rpx,
|
||||
// letterSpacing: 0.0,
|
||||
// color: themeController
|
||||
// .currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// Icon(
|
||||
// Icons.wifi_outlined,
|
||||
// size: 30.rpx,
|
||||
// color: themeController
|
||||
// .currentColor.sc3,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment:
|
||||
// MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Text(
|
||||
// '6503',
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Inter',
|
||||
// fontSize: 30.rpx,
|
||||
// letterSpacing: 0.0,
|
||||
// color: themeController
|
||||
// .currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// Icon(
|
||||
// Icons.wifi_outlined,
|
||||
// size: 30.rpx,
|
||||
// color: themeController
|
||||
// .currentColor.sc3,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment:
|
||||
// MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Text(
|
||||
// '6503',
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Inter',
|
||||
// fontSize: 30.rpx,
|
||||
// letterSpacing: 0.0,
|
||||
// color: themeController
|
||||
// .currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// Icon(
|
||||
// Icons.wifi_outlined,
|
||||
// size: 30.rpx,
|
||||
// color: themeController
|
||||
// .currentColor.sc3,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// Row(
|
||||
// mainAxisSize: MainAxisSize.max,
|
||||
// mainAxisAlignment:
|
||||
// MainAxisAlignment.spaceBetween,
|
||||
// children: [
|
||||
// Text(
|
||||
// '6503',
|
||||
// style: FlutterFlowTheme.of(context)
|
||||
// .bodyMedium
|
||||
// .override(
|
||||
// fontFamily: 'Inter',
|
||||
// fontSize: 30.rpx,
|
||||
// letterSpacing: 0.0,
|
||||
// color: themeController
|
||||
// .currentColor.sc3,
|
||||
// ),
|
||||
// ),
|
||||
// Icon(
|
||||
// Icons.wifi_outlined,
|
||||
// size: 30.rpx,
|
||||
// color: themeController
|
||||
// .currentColor.sc3,
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ].divide(SizedBox(height: 67.rpx)),
|
||||
// ),
|
||||
Obx(() {
|
||||
final sortedList = [
|
||||
...blueteethBindController.wifiList.value
|
||||
@@ -413,7 +290,7 @@ class _WifiPageState extends State<WifiPage> {
|
||||
.currentColor.sc3,
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 0.rpx,
|
||||
horizontal: 20.rpx),
|
||||
horizontal: 0.rpx),
|
||||
borderRadius: 16.rpx,
|
||||
onTap: () {
|
||||
showWifiDialog(
|
||||
@@ -573,9 +450,9 @@ class _WifiPageState extends State<WifiPage> {
|
||||
color: Colors
|
||||
.black),
|
||||
cursorColor:
|
||||
FlutterFlowTheme.of(
|
||||
context)
|
||||
.primaryText,
|
||||
themeController
|
||||
.currentColor
|
||||
.sc3,
|
||||
);
|
||||
})),
|
||||
),
|
||||
@@ -591,21 +468,75 @@ class _WifiPageState extends State<WifiPage> {
|
||||
.model.wifiPass!,
|
||||
blueteethBindController
|
||||
.currentDevice!);
|
||||
Navigator.pop(context);
|
||||
// Navigator.pop(context);
|
||||
if (flag) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "wifi页.配网成功".tr,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc2,
|
||||
);
|
||||
// bool wifiStatus =
|
||||
// await getWifiStatus(
|
||||
// blueteethBindController
|
||||
// .currentDevice!);
|
||||
bool wifiStatus = false;
|
||||
var aa = await getDeviceWifiStatus(
|
||||
blueteethBindController
|
||||
.currentDevice!,
|
||||
20);
|
||||
if (aa != null &&
|
||||
aa is Map) {
|
||||
wifiStatus = true;
|
||||
blueteethBindController
|
||||
.connect_wifi
|
||||
.value = aa;
|
||||
} else {
|
||||
blueteethBindController
|
||||
.connect_wifi
|
||||
.value = {};
|
||||
}
|
||||
blueteethBindController
|
||||
.wifiStatus.value = 1;
|
||||
.wifiStatus
|
||||
.value =
|
||||
wifiStatus == true
|
||||
? 1
|
||||
: 0;
|
||||
blueteethBindController
|
||||
.updateAll();
|
||||
.wifiStatus
|
||||
.value =
|
||||
wifiStatus == true
|
||||
? 1
|
||||
: 0;
|
||||
if (wifiStatus) {
|
||||
Navigator.pop(context);
|
||||
TopSlideNotification
|
||||
.show(
|
||||
context,
|
||||
text: "wifi页.配网成功".tr,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc2,
|
||||
);
|
||||
blueteethBindController
|
||||
.wifiStatus
|
||||
.value = 1;
|
||||
blueteethBindController
|
||||
.updateAll();
|
||||
} else {
|
||||
Navigator.pop(context);
|
||||
TopSlideNotification
|
||||
.show(
|
||||
context,
|
||||
text: "wifi页.配网失败".tr,
|
||||
textColor:
|
||||
themeController
|
||||
.currentColor
|
||||
.sc9,
|
||||
);
|
||||
blueteethBindController
|
||||
.wifiStatus
|
||||
.value = 0;
|
||||
blueteethBindController
|
||||
.updateAll();
|
||||
}
|
||||
} else {
|
||||
Navigator.pop(context);
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "wifi页.配网失败".tr,
|
||||
@@ -651,7 +582,6 @@ class _WifiPageState extends State<WifiPage> {
|
||||
.divide(SizedBox(height: 67.rpx)),
|
||||
);
|
||||
}),
|
||||
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: Colors.white,
|
||||
@@ -774,16 +704,14 @@ class _WifiPageState extends State<WifiPage> {
|
||||
}
|
||||
if (onData.status == BleEventType.ready) {
|
||||
showLoadingDialog(context, title: "获取wifi列表中...".tr);
|
||||
bool wifiStatus =
|
||||
await getWifiStatus(blueteethBindController.currentDevice!);
|
||||
bool wifiStatus = false;
|
||||
var aa = await getDeviceWifiStatus(
|
||||
blueteethBindController.currentDevice!, 10);
|
||||
if (aa != null && aa is Map) {
|
||||
wifiStatus = true;
|
||||
blueteethBindController.connect_wifi.value = aa;
|
||||
}
|
||||
blueteethBindController.wifiStatus.value = wifiStatus == true ? 1 : 0;
|
||||
// if (wifiStatus) {
|
||||
// Map connect_wifiInfo =
|
||||
// await getDeviceWifiStatus(blueteethBindController.currentDevice!);
|
||||
// if (connect_wifiInfo != null) {
|
||||
// blueteethBindController.connect_wifi.value = connect_wifiInfo;
|
||||
// }
|
||||
// }
|
||||
List wifiList =
|
||||
await getWifiList(blueteethBindController.currentDevice!);
|
||||
if (wifiList.length > 0) {
|
||||
@@ -827,77 +755,50 @@ class _WifiPageState extends State<WifiPage> {
|
||||
}
|
||||
|
||||
getWifiIconByRsso(wifiItem) {
|
||||
if (wifiItem['rssi'] >= -30) {
|
||||
// return SvgPicture.asset(
|
||||
// 'assets/img/icon/wifi4.svg',
|
||||
// width: 25.rpx,
|
||||
// height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
// color: themeController.currentColor.sc3,
|
||||
// );
|
||||
return Container(
|
||||
width: 40.rpx,
|
||||
height: 40.rpx,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Image.asset(
|
||||
"assets/img/wifi4.png",
|
||||
),
|
||||
);
|
||||
} else if (wifiItem['rssi'] >= -45) {
|
||||
// return SvgPicture.asset(
|
||||
// 'assets/img/icon/wifi3.svg',
|
||||
// width: 25.rpx,
|
||||
// height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
// color: themeController.currentColor.sc3,
|
||||
// );
|
||||
return Container(
|
||||
width: 40.rpx,
|
||||
height: 40.rpx,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Image.asset(
|
||||
"assets/img/wifi3.png",
|
||||
),
|
||||
);
|
||||
} else if (wifiItem['rssi'] >= -60) {
|
||||
// return SvgPicture.asset(
|
||||
// 'assets/img/icon/wifi2.svg',
|
||||
// width: 25.rpx,
|
||||
// height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
// color: themeController.currentColor.sc3,
|
||||
// );
|
||||
return Container(
|
||||
width: 40.rpx,
|
||||
height: 40.rpx,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Image.asset(
|
||||
"assets/img/wifi3.png",
|
||||
),
|
||||
);
|
||||
int? rssi = int.tryParse(wifiItem['rssi'].toString());
|
||||
|
||||
if (rssi != null) {
|
||||
if (rssi >= -30) {
|
||||
return Container(
|
||||
width: 40.rpx,
|
||||
height: 40.rpx,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(shape: BoxShape.circle),
|
||||
child: Image.asset("assets/img/wifi4.png"),
|
||||
);
|
||||
} else if (rssi >= -45) {
|
||||
return Container(
|
||||
width: 40.rpx,
|
||||
height: 40.rpx,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(shape: BoxShape.circle),
|
||||
child: Image.asset("assets/img/wifi3.png"),
|
||||
);
|
||||
} else if (rssi >= -60) {
|
||||
return Container(
|
||||
width: 40.rpx,
|
||||
height: 40.rpx,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(shape: BoxShape.circle),
|
||||
child: Image.asset("assets/img/wifi3.png"),
|
||||
);
|
||||
} else {
|
||||
return Container(
|
||||
width: 40.rpx,
|
||||
height: 40.rpx,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(shape: BoxShape.circle),
|
||||
child: Image.asset("assets/img/wifi1.png"),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// return SvgPicture.asset(
|
||||
// 'assets/img/icon/wifi1.svg',
|
||||
// width: 25.rpx,
|
||||
// height: 25.rpx, // 如果 SVG 中没有固定颜色,可以这样设置
|
||||
// color: themeController.currentColor.sc3,
|
||||
// );
|
||||
// RSSI 无法解析时的默认显示
|
||||
return Container(
|
||||
width: 40.rpx,
|
||||
height: 40.rpx,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Image.asset(
|
||||
"assets/img/wifi1.png",
|
||||
),
|
||||
decoration: BoxDecoration(shape: BoxShape.circle),
|
||||
child: Image.asset("assets/img/wifi1.png"),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,11 +3,14 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:fluwx/fluwx.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/CheckNetwork.dart';
|
||||
import 'package:vbvs_app/common/util/CommonVariables.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/common/util/requestWithLog.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';
|
||||
@@ -15,6 +18,7 @@ import 'package:vbvs_app/controller/login/login_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
|
||||
class LoginPage extends StatefulWidget {
|
||||
const LoginPage({super.key});
|
||||
@@ -54,7 +58,7 @@ class _EPageState extends State<LoginPage> {
|
||||
int errCode = response.errCode ?? -9999;
|
||||
if (errCode == 0) {
|
||||
// TODO 微信登录成功 传递code给后台 再操作逻辑
|
||||
String code = response.code ?? "";
|
||||
String code = response.code ?? "";
|
||||
//把微信登录返回的code传给后台,剩下的事就交给后台处理
|
||||
//首次未注册的用户引导去手机号填写页面
|
||||
//已注册的用户直接跳转首页
|
||||
@@ -62,8 +66,8 @@ class _EPageState extends State<LoginPage> {
|
||||
showToast("网络未连接,请开启设备网络后重试");
|
||||
return;
|
||||
}
|
||||
String msg = await loginController.loginByWechatCode(code);
|
||||
if (msg.isEmpty) {
|
||||
ApiResponse msg = await loginController.loginByWechatCode(code);
|
||||
if (msg.code == HttpStatusCodes.ok) {
|
||||
// TODO 操作全部跳转页面前成功以后移除监听,防止重复监听,其他方式登录成功也需要移出监听
|
||||
loginController.fluwxCancelable?.cancel();
|
||||
// 登录成功移出网络检查监听
|
||||
|
||||
@@ -153,8 +153,9 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
AppConstants()
|
||||
.button_container_radius),
|
||||
border: Border.all(
|
||||
color: themeController.currentColor.sc3,
|
||||
width: 1.rpx,
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
constraints: BoxConstraints(
|
||||
@@ -264,10 +265,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
cursorColor:
|
||||
FlutterFlowTheme.of(
|
||||
context)
|
||||
.primaryText,
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
// validator: _model
|
||||
// .textControllerValidator
|
||||
// .asValidator(context),
|
||||
@@ -295,8 +294,9 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
AppConstants()
|
||||
.button_container_radius),
|
||||
border: Border.all(
|
||||
color: themeController.currentColor.sc3,
|
||||
width: 1.rpx,
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
constraints: BoxConstraints(
|
||||
@@ -406,10 +406,8 @@ class _OtherLoginPageState extends State<OtherLoginPage> {
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
cursorColor:
|
||||
FlutterFlowTheme.of(
|
||||
context)
|
||||
.primaryText,
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
// validator: _model
|
||||
// .textControllerValidator
|
||||
// .asValidator(context),
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
@@ -122,7 +123,7 @@ class MainPageBottomChange extends GetView<MainPageController> {
|
||||
top: BorderSide(
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: 0.5,
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -203,7 +204,7 @@ class MainPageBottomChange extends GetView<MainPageController> {
|
||||
currentTime.difference(_lastBackPressedTime!) > Duration(seconds: 2)) {
|
||||
_lastBackPressedTime = currentTime;
|
||||
// showToast("再按一次退出程序", color: color_warning, closeTime: 2);
|
||||
TopSlideNotification.show(context,text: "滑动退出提醒".tr);
|
||||
TopSlideNotification.show(context, text: "滑动退出提醒".tr);
|
||||
return false; // 阻止退出程序
|
||||
} else {
|
||||
return true; // 允许退出程序
|
||||
|
||||
@@ -6,10 +6,10 @@ import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/base/SleepCalendarWidget.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/date/CalendarController.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
import 'package:vbvs_app/controller/theme_controller/ThemeController.dart';
|
||||
import 'package:vbvs_app/controller/user_info_controller.dart';
|
||||
@@ -26,6 +26,7 @@ class _MinePageState extends State<MinePage> {
|
||||
GlobalController globalController = Get.find();
|
||||
UserInfoController userInfoController = Get.find();
|
||||
ThemeController themeController = Get.find();
|
||||
CalendarController calendarController = Get.find();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -216,16 +217,25 @@ class _MinePageState extends State<MinePage> {
|
||||
),
|
||||
Text(
|
||||
login == 1
|
||||
? (userInfoController.model
|
||||
.user!.email !=
|
||||
null
|
||||
? userInfoController
|
||||
.model.user!.email!
|
||||
: MyUtils.hidePhoneNumber(
|
||||
? (() {
|
||||
final user =
|
||||
userInfoController
|
||||
.model
|
||||
.user!
|
||||
.phone!))
|
||||
.model.user!;
|
||||
if (user.email != null &&
|
||||
user.email!
|
||||
.isNotEmpty) {
|
||||
return user.email!;
|
||||
} else if (user.phone !=
|
||||
null &&
|
||||
user.phone!
|
||||
.isNotEmpty) {
|
||||
return MyUtils
|
||||
.hidePhoneNumber(
|
||||
user.phone!);
|
||||
} else {
|
||||
return "微信用户".tr;
|
||||
}
|
||||
})()
|
||||
: "我的.未登录".tr,
|
||||
style:
|
||||
FlutterFlowTheme.of(context)
|
||||
@@ -629,32 +639,13 @@ class _MinePageState extends State<MinePage> {
|
||||
);
|
||||
Get.toNamed("/loginPage");
|
||||
} else {
|
||||
// TopSlideNotification.show(
|
||||
// context,
|
||||
// text: "待开发.提示".tr,
|
||||
// textColor:
|
||||
// themeController.currentColor.sc2,
|
||||
// );
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: false, // 不需要滚动全屏
|
||||
backgroundColor:
|
||||
Colors.transparent, // 为了圆角和美观
|
||||
builder: (context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(
|
||||
0xFF242835), // 你组件的底色
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20.rpx),
|
||||
topRight: Radius.circular(20.rpx),
|
||||
),
|
||||
),
|
||||
child:
|
||||
SleepCalendarWidget(), // 显示日历组件
|
||||
);
|
||||
},
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "待开发.提示".tr,
|
||||
textColor:
|
||||
themeController.currentColor.sc2,
|
||||
);
|
||||
// Get.toNamed("/newSleepReportPage",arguments: DateTime.now().millisecondsSinceEpoch);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
|
||||
@@ -36,13 +36,13 @@ class _EPageState extends State<PersonPage> {
|
||||
super.initState();
|
||||
personController.getDiseaseData().then((apiResponse) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: apiResponse.code != HttpStatusCodes.ok
|
||||
? themeController.currentColor.sc9
|
||||
: themeController.currentColor.sc2,
|
||||
);
|
||||
if (apiResponse.code != HttpStatusCodes.ok) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg ?? '',
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
personController.selectedDiseaseIds.value = [];
|
||||
@@ -50,7 +50,7 @@ class _EPageState extends State<PersonPage> {
|
||||
personController.gender.value = 1;
|
||||
personController.birthday.value = "";
|
||||
personController.weight.value = 65;
|
||||
personController.dateTime = null;
|
||||
personController.dateTime = DateTime.now();
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -162,7 +162,9 @@ class _EPageState extends State<PersonPage> {
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50.rpx),
|
||||
border: Border.all(
|
||||
color: Color(0xFFF3EDED),
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
@@ -232,8 +234,7 @@ class _EPageState extends State<PersonPage> {
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
cursorColor:
|
||||
FlutterFlowTheme.of(context).primaryText,
|
||||
cursorColor: themeController.currentColor.sc3,
|
||||
// validator: _model.textController1Validator
|
||||
// .asValidator(context),
|
||||
),
|
||||
@@ -463,7 +464,11 @@ class _EPageState extends State<PersonPage> {
|
||||
height: 100.rpx,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50.rpx),
|
||||
border: Border.all(color: Color(0xFFF3EDED)),
|
||||
border: Border.all(
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
@@ -514,7 +519,9 @@ class _EPageState extends State<PersonPage> {
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50.rpx),
|
||||
border: Border.all(
|
||||
color: Color(0xFFF3EDED),
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
@@ -544,8 +551,7 @@ class _EPageState extends State<PersonPage> {
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
cursorColor:
|
||||
FlutterFlowTheme.of(context).primaryText,
|
||||
cursorColor: themeController.currentColor.sc3,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.transparent,
|
||||
isDense: true,
|
||||
@@ -682,7 +688,9 @@ class _EPageState extends State<PersonPage> {
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20.rpx),
|
||||
border: Border.all(
|
||||
color: Color(0xFFE9E3E3),
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
@@ -697,7 +705,7 @@ class _EPageState extends State<PersonPage> {
|
||||
0, 8.rpx, 0, 0),
|
||||
child: Icon(
|
||||
Icons.arrow_back,
|
||||
color: Color(0xFFE4EBF0),
|
||||
color: themeController.currentColor.sc4,
|
||||
size: 24.rpx,
|
||||
),
|
||||
),
|
||||
@@ -708,7 +716,8 @@ class _EPageState extends State<PersonPage> {
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFEEF3F8),
|
||||
color:
|
||||
themeController.currentColor.sc4,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
|
||||
@@ -39,20 +39,18 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
void initState() {
|
||||
super.initState();
|
||||
personController.getDiseaseData().then((apiResponse) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg!,
|
||||
textColor: apiResponse.code != HttpStatusCodes.ok
|
||||
? themeController.currentColor.sc9
|
||||
: themeController.currentColor.sc2,
|
||||
);
|
||||
if (apiResponse.code != HttpStatusCodes.ok) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: apiResponse.msg ?? '',
|
||||
textColor: themeController.currentColor.sc9,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print(widget.status);
|
||||
print(widget.status);
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodySize) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
@@ -89,6 +87,7 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
|
||||
/// 左边返回按钮
|
||||
Positioned(
|
||||
left: 0,
|
||||
@@ -164,7 +163,9 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50.rpx),
|
||||
border: Border.all(
|
||||
color: Color(0xFFF3EDED),
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
@@ -234,8 +235,7 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
cursorColor:
|
||||
FlutterFlowTheme.of(context).primaryText,
|
||||
cursorColor: themeController.currentColor.sc3,
|
||||
// validator: _model.textController1Validator
|
||||
// .asValidator(context),
|
||||
),
|
||||
@@ -465,7 +465,11 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
height: 100.rpx,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50.rpx),
|
||||
border: Border.all(color: Color(0xFFF3EDED)),
|
||||
border: Border.all(
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
@@ -516,7 +520,9 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(50.rpx),
|
||||
border: Border.all(
|
||||
color: Color(0xFFF3EDED),
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
@@ -546,8 +552,7 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
cursorColor:
|
||||
FlutterFlowTheme.of(context).primaryText,
|
||||
cursorColor: themeController.currentColor.sc3,
|
||||
decoration: InputDecoration(
|
||||
fillColor: Colors.transparent,
|
||||
isDense: true,
|
||||
@@ -676,7 +681,6 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0, 152.rpx, 0, 0),
|
||||
@@ -685,7 +689,9 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20.rpx),
|
||||
border: Border.all(
|
||||
color: Color(0xFFE9E3E3),
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
@@ -711,7 +717,8 @@ class _UpdatePageState extends State<UpdatePersonPage> {
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
color: Color(0xFFEEF3F8),
|
||||
color:
|
||||
themeController.currentColor.sc4,
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
|
||||
@@ -304,7 +304,8 @@ class _RepairModelWidgetState extends State<RepairModelWidget> {
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
),
|
||||
cursorColor: FlutterFlowTheme.of(context).primaryText,
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
102
lib/pages/sleep_report/component/SegmentedCirclePainter.dart
Normal file
102
lib/pages/sleep_report/component/SegmentedCirclePainter.dart
Normal file
@@ -0,0 +1,102 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
|
||||
class SegmentData {
|
||||
final Color color;
|
||||
final double value;
|
||||
|
||||
SegmentData({required this.color, required this.value});
|
||||
}
|
||||
|
||||
class SegmentedCirclePainter extends CustomPainter {
|
||||
final List<SegmentData> segments;
|
||||
final double strokeWidth;
|
||||
final double gapAngle; // 每段之间的间隔角度(单位:度)
|
||||
|
||||
SegmentedCirclePainter({
|
||||
required this.segments,
|
||||
this.strokeWidth = 6.0,
|
||||
this.gapAngle = 4.0,
|
||||
});
|
||||
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
final double radius = size.width / 2;
|
||||
final Offset center = Offset(size.width / 2, size.height / 2);
|
||||
|
||||
final Paint paint = Paint()
|
||||
..style = PaintingStyle.stroke
|
||||
..strokeWidth = strokeWidth
|
||||
..strokeCap = StrokeCap.square;
|
||||
|
||||
final double totalValue = segments.fold(0, (sum, item) => sum + item.value);
|
||||
final double totalGap = gapAngle * segments.length;
|
||||
final double totalDrawAngle = 360.0 - totalGap;
|
||||
|
||||
double startAngle = -90.0; // 从顶部开始
|
||||
|
||||
for (var segment in segments) {
|
||||
final double sweepAngle = (segment.value / totalValue) * totalDrawAngle;
|
||||
|
||||
paint.color = segment.color;
|
||||
canvas.drawArc(
|
||||
Rect.fromCircle(center: center, radius: radius - strokeWidth / 2),
|
||||
radians(startAngle),
|
||||
radians(sweepAngle),
|
||||
false,
|
||||
paint,
|
||||
);
|
||||
startAngle += sweepAngle + gapAngle;
|
||||
}
|
||||
}
|
||||
|
||||
double radians(double degrees) => degrees * 3.1415926 / 180;
|
||||
|
||||
@override
|
||||
bool shouldRepaint(covariant CustomPainter oldDelegate) => true;
|
||||
}
|
||||
|
||||
class SegmentedCircleWithCenterWidget extends StatelessWidget {
|
||||
final List<SegmentData> segments;
|
||||
final double strokeWidth;
|
||||
final double gapAngle;
|
||||
final Widget centerWidget;
|
||||
|
||||
const SegmentedCircleWithCenterWidget({
|
||||
Key? key,
|
||||
required this.segments,
|
||||
this.strokeWidth = 6.0,
|
||||
this.gapAngle = 4.0,
|
||||
required this.centerWidget,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
CustomPaint(
|
||||
size: Size(200, 200), // 设置圆的尺寸
|
||||
painter: SegmentedCirclePainter(
|
||||
segments: segments,
|
||||
strokeWidth: strokeWidth,
|
||||
gapAngle: gapAngle,
|
||||
),
|
||||
),
|
||||
centerWidget, // 放置自定义的中心 Widget
|
||||
Positioned(
|
||||
right: 60.rpx, // 放置在右侧
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/add.svg',
|
||||
width: 14.rpx,
|
||||
height: 22.rpx,
|
||||
color: themeController.currentColor.sc9,
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
178
lib/pages/sleep_report/component/SleepScoreWidget.dart
Normal file
178
lib/pages/sleep_report/component/SleepScoreWidget.dart
Normal file
@@ -0,0 +1,178 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.dart';
|
||||
import 'package:vbvs_app/common/color/appConstants.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/pages/sleep_report/component/SegmentedCirclePainter.dart';
|
||||
|
||||
class SleepScoreWidget extends StatefulWidget {
|
||||
const SleepScoreWidget({super.key});
|
||||
|
||||
@override
|
||||
State<SleepScoreWidget> createState() => _SleepScoreWidgetState();
|
||||
}
|
||||
|
||||
class _SleepScoreWidgetState extends State<SleepScoreWidget> {
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<Map<String, dynamic>> showLabel = [
|
||||
{"level": 1, "name": "优秀(≥85)", "color": Color(0xFF4CAF50)},
|
||||
{"level": 2, "name": "良好(75~84)", "color": Color(0xFF8BC34A)},
|
||||
{"level": 3, "name": "合格(60~74)", "color": Color(0xFFFFC107)},
|
||||
{"level": 4, "name": "注意(<60)", "color": Color(0xFFF44336)},
|
||||
];
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
// decoration: BoxDecoration(color: Colors.green),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(26.rpx, 29.rpx, 26.rpx, 45.rpx),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'30天平均分',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFD3D3D3),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'79',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 48.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(height: 56.rpx)),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: SegmentedCircleWithCenterWidget(
|
||||
segments: [
|
||||
SegmentData(color: Colors.red, value: 30),
|
||||
SegmentData(color: Colors.green, value: 20),
|
||||
SegmentData(color: Colors.blue, value: 40),
|
||||
SegmentData(color: Colors.orange, value: 10),
|
||||
],
|
||||
strokeWidth: 8,
|
||||
gapAngle: 8,
|
||||
centerWidget: Container(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"睡眠评分",
|
||||
style: TextStyle(
|
||||
color: stringToColor("#FFFFFF"),
|
||||
fontSize:
|
||||
AppConstants().normal_text_fontSize),
|
||||
),
|
||||
Text(
|
||||
"65",
|
||||
style: TextStyle(
|
||||
color: stringToColor("#FF9F66"),
|
||||
fontSize: 100.rpx),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'睡眠等级',
|
||||
style: TextStyle(
|
||||
color: Color(0xFFD3D3D3),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'合格',
|
||||
style: TextStyle(
|
||||
color: stringToColor("#FF9F66"),
|
||||
fontSize: 48.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(height: 56.rpx)),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(
|
||||
width: 33.rpx,
|
||||
)),
|
||||
),
|
||||
),
|
||||
Wrap(
|
||||
spacing: 32.rpx,
|
||||
runSpacing: 20.rpx,
|
||||
children: showLabel.map<Widget>((item) {
|
||||
return Container(
|
||||
padding: EdgeInsets.all(5.rpx),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 20.rpx,
|
||||
height: 20.rpx,
|
||||
decoration: BoxDecoration(
|
||||
color: item["color"],
|
||||
borderRadius: BorderRadius.circular(10.rpx),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 17.rpx),
|
||||
Text(
|
||||
item["name"],
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24.rpx,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
631
lib/pages/sleep_report/new_sleep_report_page.dart
Normal file
631
lib/pages/sleep_report/new_sleep_report_page.dart
Normal file
@@ -0,0 +1,631 @@
|
||||
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/appConstants.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/controller/date/CalendarController.dart';
|
||||
import 'package:vbvs_app/controller/sleep/sleep_report_controller.dart';
|
||||
import 'package:vbvs_app/pages/common/selectDialog.dart';
|
||||
import 'package:vbvs_app/pages/sleep_report/component/SleepScoreWidget.dart';
|
||||
|
||||
class NewSleepReportPage extends StatefulWidget {
|
||||
var date;
|
||||
NewSleepReportPage({super.key, required this.date});
|
||||
|
||||
@override
|
||||
State<NewSleepReportPage> createState() => _NewSleepReportPageState();
|
||||
}
|
||||
|
||||
class _NewSleepReportPageState extends State<NewSleepReportPage> {
|
||||
SleepReportController sleepReportController = Get.find();
|
||||
CalendarController calendarController = Get.find();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (widget == null) {
|
||||
widget.date = DateTime.now();
|
||||
}
|
||||
calendarController.selectedDate.value =
|
||||
DateTime.fromMillisecondsSinceEpoch(widget.date);
|
||||
sleepReportController.selectedDate.value =
|
||||
DateTime.fromMillisecondsSinceEpoch(widget.date);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, bodySize) => GestureDetector(
|
||||
onTap: () => FocusScope.of(context).unfocus(),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('assets/img/bgNoImg.png'), // 本地图片
|
||||
fit: BoxFit.fill, // 填满整个 Container
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent, // 背景透明
|
||||
appBar: AppBar(
|
||||
backgroundColor: themeController.currentColor.sc17,
|
||||
automaticallyImplyLeading: false,
|
||||
iconTheme: IconThemeData(color: themeController.currentColor.sc3),
|
||||
titleSpacing: 0,
|
||||
title: Container(
|
||||
width: double.infinity,
|
||||
height: 180.rpx,
|
||||
child: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
/// 居中标题
|
||||
Text(
|
||||
'健康报告'.tr,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Readex Pro',
|
||||
color: themeController.currentColor.sc3,
|
||||
letterSpacing: 0,
|
||||
fontSize: 30.rpx,
|
||||
),
|
||||
),
|
||||
|
||||
/// 左边返回按钮
|
||||
Positioned(
|
||||
left: 0,
|
||||
child: returnIconButtom,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
body: SafeArea(
|
||||
top: true,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(0, 30.rpx, 0, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 90.rpx,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: themeController.currentColor.sc5),
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 15.rpx, 30.rpx, 15.rpx),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Stack(
|
||||
alignment: Alignment.bottomLeft,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Obx(() {
|
||||
return ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor:
|
||||
themeController.currentColor.sc3,
|
||||
borderRadius: 8.rpx,
|
||||
padding: EdgeInsets.all(0),
|
||||
onTap: () async {
|
||||
sleepReportController.model.type =
|
||||
1;
|
||||
sleepReportController.updateAll();
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: 115.rpx, // 固定宽度为 160.rpx
|
||||
alignment:
|
||||
Alignment.center, // 文字居中
|
||||
child: Text(
|
||||
'日报'.tr,
|
||||
style: FlutterFlowTheme.of(
|
||||
context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
color:
|
||||
sleepReportController
|
||||
.model
|
||||
.type ==
|
||||
1
|
||||
? themeController
|
||||
.currentColor
|
||||
.sc2
|
||||
: themeController
|
||||
.currentColor
|
||||
.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10.rpx),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
Obx(() {
|
||||
return ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor:
|
||||
themeController.currentColor.sc3,
|
||||
borderRadius: 8.rpx,
|
||||
padding: EdgeInsets.all(0),
|
||||
onTap: () async {
|
||||
sleepReportController.model.type =
|
||||
2;
|
||||
sleepReportController.updateAll();
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: 115.rpx, // 固定宽度为 160.rpx
|
||||
alignment:
|
||||
Alignment.center, // 文字居中
|
||||
child: Text(
|
||||
'周报'.tr,
|
||||
style: FlutterFlowTheme.of(
|
||||
context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
color:
|
||||
sleepReportController
|
||||
.model
|
||||
.type ==
|
||||
2
|
||||
? themeController
|
||||
.currentColor
|
||||
.sc2
|
||||
: themeController
|
||||
.currentColor
|
||||
.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10.rpx),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
Obx(() {
|
||||
return ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor:
|
||||
themeController.currentColor.sc3,
|
||||
borderRadius: 8.rpx,
|
||||
padding: EdgeInsets.all(0),
|
||||
onTap: () async {
|
||||
sleepReportController.model.type =
|
||||
3;
|
||||
sleepReportController.updateAll();
|
||||
},
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Container(
|
||||
width: 115.rpx, // 固定宽度为 160.rpx
|
||||
alignment:
|
||||
Alignment.center, // 文字居中
|
||||
child: Text(
|
||||
'月报'.tr,
|
||||
style: FlutterFlowTheme.of(
|
||||
context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: AppConstants()
|
||||
.title_text_fontSize,
|
||||
letterSpacing: 0.0,
|
||||
color:
|
||||
sleepReportController
|
||||
.model
|
||||
.type ==
|
||||
3
|
||||
? themeController
|
||||
.currentColor
|
||||
.sc2
|
||||
: themeController
|
||||
.currentColor
|
||||
.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10.rpx),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
Obx(() {
|
||||
double lineWidth = 115.rpx;
|
||||
return AnimatedPositioned(
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
bottom: 0,
|
||||
left: sleepReportController.model.type ==
|
||||
1
|
||||
? 0
|
||||
: sleepReportController.model.type ==
|
||||
2
|
||||
? 115.rpx
|
||||
: 230.rpx,
|
||||
child: Container(
|
||||
width: lineWidth,
|
||||
height: 4.rpx,
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
themeController.currentColor.sc2,
|
||||
borderRadius:
|
||||
BorderRadius.circular(2.rpx),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0, 0.rpx, 0.rpx, 0),
|
||||
child: Container(
|
||||
width: 28.rpx,
|
||||
height: 28.rpx,
|
||||
// width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/share.svg',
|
||||
fit: BoxFit.cover,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
child: Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 57.rpx, 30.rpx, 57.rpx),
|
||||
child: Obx(() {
|
||||
var date = sleepReportController.selectedDate;
|
||||
return getTimeWidget();
|
||||
}),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 0.rpx, 30.rpx, 58.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(
|
||||
'传感器1号',
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'2022-02-02',
|
||||
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(
|
||||
'1231212',
|
||||
// "D11250300003",
|
||||
style: FlutterFlowTheme.of(context)
|
||||
.bodyMedium
|
||||
.override(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
color: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'55kg',
|
||||
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)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 0.rpx, 30.rpx, 0),
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
child: SleepScoreWidget(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget getTimeWidget() {
|
||||
if (sleepReportController.model.type == 1) {
|
||||
//日报
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Container(
|
||||
width: 28.rpx,
|
||||
height: 28.rpx,
|
||||
// width: double.infinity,
|
||||
decoration: BoxDecoration(),
|
||||
),
|
||||
Container(
|
||||
child: Row(
|
||||
children: [
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: themeController.currentColor.sc3,
|
||||
padding: EdgeInsets.all(10.rpx), // 增加点击热区
|
||||
borderRadius: 8.rpx,
|
||||
onTap: () {
|
||||
sleepReportController.selectedDate.value =
|
||||
sleepReportController.selectedDate.value!
|
||||
.subtract(const Duration(days: 1));
|
||||
calendarController.selectedDate.value =
|
||||
sleepReportController.selectedDate.value;
|
||||
sleepReportController.updateAll();
|
||||
calendarController.updateAll();
|
||||
},
|
||||
child: SizedBox(
|
||||
width: 9.rpx,
|
||||
height: 14.rpx,
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/arrow_left.svg',
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
MyUtils.getFormatChineseTime(sleepReportController
|
||||
.selectedDate.value!.millisecondsSinceEpoch),
|
||||
style: TextStyle(
|
||||
fontSize: AppConstants().normal_text_fontSize,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: themeController.currentColor.sc3,
|
||||
padding: EdgeInsets.all(10.rpx), // 增加点击热区
|
||||
borderRadius: 8.rpx,
|
||||
onTap: () {
|
||||
sleepReportController.selectedDate.value =
|
||||
sleepReportController.selectedDate.value!
|
||||
.subtract(const Duration(days: -1));
|
||||
calendarController.selectedDate.value =
|
||||
sleepReportController.selectedDate.value;
|
||||
sleepReportController.updateAll();
|
||||
calendarController.updateAll();
|
||||
},
|
||||
child: SizedBox(
|
||||
width: 9.rpx,
|
||||
height: 14.rpx,
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/arrow_right.svg',
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
].divide(SizedBox(
|
||||
width: 26.rpx,
|
||||
)),
|
||||
),
|
||||
),
|
||||
ClickableContainer(
|
||||
backgroundColor: Colors.transparent,
|
||||
highlightColor: themeController.currentColor.sc3,
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
0.rpx,
|
||||
0.rpx,
|
||||
0.rpx,
|
||||
0.rpx,
|
||||
),
|
||||
borderRadius: 0,
|
||||
onTap: () {
|
||||
showSleepCalendarBottomSheet(
|
||||
timestamp: sleepReportController
|
||||
.selectedDate.value!.millisecondsSinceEpoch,
|
||||
context: context,
|
||||
onDateSelected: (selectedDate) {
|
||||
print("选中日期:");
|
||||
print(selectedDate);
|
||||
sleepReportController.selectedDate.value = selectedDate;
|
||||
calendarController.selectedDate.value = selectedDate;
|
||||
sleepReportController.updateAll();
|
||||
calendarController.updateAll();
|
||||
});
|
||||
},
|
||||
child: SizedBox(
|
||||
width: 28.rpx,
|
||||
height: 28.rpx,
|
||||
child: SvgPicture.asset(
|
||||
'assets/img/icon/share.svg',
|
||||
fit: BoxFit.cover,
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
if (sleepReportController.model.type == 2) {
|
||||
//周报
|
||||
}
|
||||
if (sleepReportController.model.type == 3) {
|
||||
//月报
|
||||
}
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
import 'package:vbvs_app/common/util/MyUtils.dart';
|
||||
import 'package:vbvs_app/component/tool/CustomCard.dart';
|
||||
import 'package:vbvs_app/component/tool/TopSlideNotification.dart';
|
||||
import 'package:vbvs_app/controller/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/device/device_type_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
@@ -26,7 +24,6 @@ class _SleepReportPageState extends State<SleepReportPage> {
|
||||
ThemeController themeController = Get.find();
|
||||
DeviceTypeController deviceTypeController = Get.find();
|
||||
|
||||
// 使用 ValueNotifier 来管理加载状态
|
||||
ValueNotifier<bool> isPageLoading = ValueNotifier<bool>(true);
|
||||
|
||||
@override
|
||||
@@ -121,56 +118,5 @@ class _SleepReportPageState extends State<SleepReportPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDeviceCard(BuildContext context,
|
||||
{required String title, required String imageUrl, required double type}) {
|
||||
return CustomCard(
|
||||
borderRadius: 20.rpx, // 圆角大小
|
||||
onTap: () {
|
||||
if (type != null) {
|
||||
if (type == 1) {
|
||||
Get.toNamed("/bodyDevice");
|
||||
}
|
||||
if (type == 2) {
|
||||
TopSlideNotification.show(
|
||||
context,
|
||||
text: "待开发.提示".tr,
|
||||
textColor: themeController.currentColor.sc2,
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
colors: [themeController.currentColor.sc17], // 背景色
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: MediaQuery.sizeOf(context).height * 0.135,
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 220.rpx,
|
||||
),
|
||||
padding: EdgeInsetsDirectional.fromSTEB(77.rpx, 0, 21.rpx, 0),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
||||
fontFamily: 'Inter',
|
||||
color: const Color(0xFFC2CED7),
|
||||
fontSize: 30.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.rpx),
|
||||
child: Image.network(
|
||||
imageUrl,
|
||||
width: 212.rpx,
|
||||
height: 168.rpx,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
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/appConstants.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/controller/device/blueteeth_bind_controller.dart';
|
||||
import 'package:vbvs_app/controller/main_bottom/global_controller.dart';
|
||||
|
||||
@@ -56,7 +56,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
iconTheme: IconThemeData(
|
||||
color: themeController.currentColor.sc3,
|
||||
),
|
||||
titleSpacing: 0,
|
||||
titleSpacing: 0.rpx,
|
||||
// leading: returnIconButtom,
|
||||
title: Container(
|
||||
width: double.infinity,
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:EasyDartModule/EasyDartModule.dart' as edm;
|
||||
import 'package:ef/ef.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutterflow_ui/flutterflow_ui.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/DailyLogUtils.dart';
|
||||
import 'package:vbvs_app/common/util/FitTool.dart';
|
||||
@@ -205,12 +206,14 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: Color(0xFFF8F5F5),
|
||||
width: 1.rpx,
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
bottom: BorderSide(
|
||||
color: Color(0xFFF8F5F5),
|
||||
width: 1.rpx,
|
||||
color: themeController.currentColor.sc4
|
||||
.withOpacity(0.5),
|
||||
width: AppConstants().border_width,
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -312,9 +315,8 @@ class _UpdateUserPageState extends State<UpdateUserPage> {
|
||||
.currentColor.sc3,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
cursorColor:
|
||||
FlutterFlowTheme.of(context)
|
||||
.primaryText,
|
||||
cursorColor: themeController
|
||||
.currentColor.sc3,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user