1.修复睡眠日报中睡眠规律性数据显示错误
2.更新时区设置
This commit is contained in:
@@ -25,7 +25,6 @@ import 'package:vbvs_app/enum/BindType.dart';
|
||||
import 'package:vbvs_app/model/api_response.dart';
|
||||
import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||
|
||||
|
||||
class DeviceDataComponentWidget extends StatefulWidget {
|
||||
final Map<String, dynamic> device;
|
||||
|
||||
@@ -44,6 +43,7 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
bool _isPopupOpen = false;
|
||||
|
||||
var lisObj;
|
||||
late StreamSubscription<ScrollNotificationEvent> _scrollSubscription;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
@@ -64,6 +64,12 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
cityController.cityList = [];
|
||||
await initializeCityData();
|
||||
});
|
||||
_scrollSubscription =
|
||||
EventBus().on<ScrollNotificationEvent>().listen((event) {
|
||||
if (_isPopupOpen) {
|
||||
_closePopup();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _showPopup() {
|
||||
@@ -628,7 +634,7 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
maxWidth: MediaQuery.sizeOf(context).width * 0.6,
|
||||
),
|
||||
child: Text(
|
||||
'${widget.device['person']?['name'] ?? '未命名'.tr}',
|
||||
'${(widget.device['person']?['name'] as String?)?.isNotEmpty == true ? widget.device['person']!['name'] : '体征检测设备'.tr}',
|
||||
style: TextStyle(
|
||||
fontFamily: 'Inter',
|
||||
fontSize: 30.rpx,
|
||||
@@ -1180,6 +1186,8 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
personController.dateTime =
|
||||
MyUtils.formatBirthdayTime(
|
||||
widget.device['person']['birthday']);
|
||||
personController.timeZone.value =
|
||||
widget.device['person']['UTC'] ?? '';
|
||||
if (widget.device['person']['city_id'] != null) {
|
||||
// 根据city_id查找完整的城市数据
|
||||
final int cityId =
|
||||
@@ -1208,6 +1216,7 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
personController.weight.value = "";
|
||||
personController.diseaseList.value = [];
|
||||
personController.cityModel = null;
|
||||
personController.timeZone.value = "";
|
||||
}
|
||||
await Get.toNamed("/updatePersonPage",
|
||||
arguments: widget.device['bind_type']);
|
||||
@@ -1701,4 +1710,12 @@ class _DeviceDataComponentWidgetState extends State<DeviceDataComponentWidget> {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void _closePopup() {
|
||||
setState(() {
|
||||
_isPopupOpen = false;
|
||||
});
|
||||
_popupEntry?.remove();
|
||||
_popupEntry = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -659,7 +659,7 @@ class _MessageSettingPageState extends State<MessageSettingPage> {
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
40.rpx, 40.rpx, 40.rpx, 20.rpx),
|
||||
30.rpx, 40.rpx, 30.rpx, 20.rpx),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
@@ -681,9 +681,9 @@ class _MessageSettingPageState extends State<MessageSettingPage> {
|
||||
(data["real"] as List)[i].containsKey("name"))
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
40.rpx,
|
||||
30.rpx,
|
||||
i == 0 ? 20.rpx : 0, // 第一个元素顶部有20.rpx间距
|
||||
40.rpx,
|
||||
30.rpx,
|
||||
i == (data["real"] as List).length - 1
|
||||
? 20.rpx
|
||||
: 0.rpx),
|
||||
@@ -781,7 +781,7 @@ class _MessageSettingPageState extends State<MessageSettingPage> {
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
40.rpx, 40.rpx, 40.rpx, 20.rpx),
|
||||
30.rpx, 40.rpx, 30.rpx, 20.rpx),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
@@ -803,9 +803,9 @@ class _MessageSettingPageState extends State<MessageSettingPage> {
|
||||
(data["report"] as List)[i].containsKey("name"))
|
||||
Padding(
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
40.rpx,
|
||||
30.rpx,
|
||||
i == 0 ? 20.rpx : 0, // 第一个元素顶部有20.rpx间距
|
||||
40.rpx,
|
||||
30.rpx,
|
||||
i == (data["report"] as List).length - 1
|
||||
? 20.rpx
|
||||
: 0.rpx),
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -96,7 +96,7 @@ getContentById(data, BuildContext context) {
|
||||
),
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(40.rpx, 20.rpx, 40.rpx, 20.rpx),
|
||||
EdgeInsetsDirectional.fromSTEB(30.rpx, 20.rpx, 30.rpx, 20.rpx),
|
||||
child: Column(
|
||||
children: [
|
||||
/// --- 心率小于 ---
|
||||
@@ -379,8 +379,8 @@ getContentById(data, BuildContext context) {
|
||||
} else if (id == 100002) {
|
||||
// 呼吸异常
|
||||
|
||||
int min = 10; // 默认
|
||||
int max = 40; // 默认
|
||||
int min = 8; // 默认
|
||||
int max = 25; // 默认
|
||||
int interval = 600; // 默认
|
||||
|
||||
// 若有用户配置
|
||||
@@ -434,7 +434,7 @@ getContentById(data, BuildContext context) {
|
||||
),
|
||||
child: Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(40.rpx, 20.rpx, 40.rpx, 20.rpx),
|
||||
EdgeInsetsDirectional.fromSTEB(30.rpx, 20.rpx, 30.rpx, 20.rpx),
|
||||
child: Column(
|
||||
children: [
|
||||
/// ---- 呼吸小于 ----
|
||||
@@ -1025,7 +1025,7 @@ getContentById(data, BuildContext context) {
|
||||
} else if (id == 100005) {
|
||||
// 未起床
|
||||
// 1. 优先从 device_type_setting 中查找用户配置
|
||||
String time = "23:00"; // 默认值
|
||||
String time = "7:00"; // 默认值
|
||||
|
||||
// 2. 如果找到了用户配置,使用用户配置中的 time 值
|
||||
if (userConfig != null) {
|
||||
@@ -1187,7 +1187,7 @@ getContentById(data, BuildContext context) {
|
||||
);
|
||||
} else if (id == 200001) {
|
||||
// 1. 优先从 device_type_setting 中查找用户配置
|
||||
int score = 60; // 默认值
|
||||
int score = 50; // 默认值
|
||||
// 2. 如果找到了用户配置,使用用户配置中的 max 值
|
||||
if (userConfig != null) {
|
||||
print('找到用户配置: $userConfig');
|
||||
@@ -1195,7 +1195,7 @@ getContentById(data, BuildContext context) {
|
||||
if (userConfig['max'] != null) {
|
||||
score = userConfig['max'] is int
|
||||
? userConfig['max']
|
||||
: int.tryParse(userConfig['max'].toString()) ?? 60;
|
||||
: int.tryParse(userConfig['max'].toString()) ?? score;
|
||||
print('从用户配置获取睡眠得分阈值: $score');
|
||||
}
|
||||
} else {
|
||||
@@ -1207,7 +1207,7 @@ getContentById(data, BuildContext context) {
|
||||
if (defaultConfig['max'] != null) {
|
||||
score = defaultConfig['max'] is int
|
||||
? defaultConfig['max']
|
||||
: int.tryParse(defaultConfig['max'].toString()) ?? 60;
|
||||
: int.tryParse(defaultConfig['max'].toString()) ?? score;
|
||||
print('从默认配置获取睡眠得分阈值: $score');
|
||||
}
|
||||
} else {
|
||||
@@ -1235,8 +1235,8 @@ getContentById(data, BuildContext context) {
|
||||
onTap: () async {
|
||||
final currentScore = score;
|
||||
final initialScore = currentScore != null
|
||||
? int.tryParse(currentScore.toString()) ?? 60
|
||||
: 60;
|
||||
? int.tryParse(currentScore.toString()) ?? score
|
||||
: score;
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
Future.delayed(const Duration(milliseconds: 250), () {
|
||||
showScorePickerDialog(
|
||||
|
||||
Reference in New Issue
Block a user