更新睡眠报告
This commit is contained in:
@@ -52,6 +52,7 @@ class _BreatheCardState extends State<BreatheCard> {
|
||||
runSpacing: 25.rpx, // 每行之间的垂直间距
|
||||
children: List.generate(data.length, (index) {
|
||||
final item = data[index];
|
||||
item['showTip'] = true;
|
||||
return SizedBox(
|
||||
width: (MediaQuery.of(context).size.width - 160.rpx) / 3,
|
||||
child: SleepDataModuleWidget(data: item),
|
||||
|
||||
@@ -105,9 +105,18 @@ class _SnoreViewWidgetWidgetState extends State<BreathePauseNewWidget> {
|
||||
SizedBox(
|
||||
height: 32.rpx,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"秒".tr,
|
||||
style: TextStyle(
|
||||
color: stringToColor("#FFFFFF"), fontSize: 18.rpx),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||
EdgeInsetsDirectional.fromSTEB(0.rpx, 40.rpx, 0.rpx, 0.rpx),
|
||||
child: LineChartByRange(
|
||||
showLabel: showLabel,
|
||||
startTime: startTime,
|
||||
|
||||
@@ -59,6 +59,48 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
return TimeSeriesPoint(x, y);
|
||||
}).toList();
|
||||
|
||||
List<Map<String, dynamic>> brs =
|
||||
(widget.sleepReport['brs'] as List).cast<Map<String, dynamic>>();
|
||||
//307 平均呼吸
|
||||
//305 基准呼吸
|
||||
//308 最低呼吸
|
||||
//309 最高呼吸
|
||||
// 307 平均呼吸
|
||||
Map<String, dynamic>? avgBreath = brs.firstWhere(
|
||||
(element) => element['id'] == 307,
|
||||
orElse: () => {},
|
||||
);
|
||||
|
||||
// 305 基准呼吸
|
||||
Map<String, dynamic>? baseBreath = brs.firstWhere(
|
||||
(element) => element['id'] == 305,
|
||||
orElse: () => {},
|
||||
);
|
||||
|
||||
// 308 最低呼吸
|
||||
Map<String, dynamic>? minBreath = brs.firstWhere(
|
||||
(element) => element['id'] == 308,
|
||||
orElse: () => {},
|
||||
);
|
||||
|
||||
// 309 最高呼吸
|
||||
Map<String, dynamic>? maxBreath = brs.firstWhere(
|
||||
(element) => element['id'] == 309,
|
||||
orElse: () => {},
|
||||
);
|
||||
|
||||
String range = baseBreath['range'] ?? '';
|
||||
int min = 0;
|
||||
int max = 0;
|
||||
|
||||
if (range.isNotEmpty && range.contains('~')) {
|
||||
List<String> parts = range.split('~');
|
||||
if (parts.length == 2) {
|
||||
min = int.tryParse(parts[0]) ?? 0;
|
||||
max = int.tryParse(parts[1]) ?? 0;
|
||||
}
|
||||
}
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
@@ -76,7 +118,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"呼吸基准".tr,
|
||||
"呼吸数据".tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize: AppConstants().title_text_fontSize),
|
||||
@@ -92,7 +134,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
context,
|
||||
Container(
|
||||
child: Text(
|
||||
"呼吸基准介绍".tr,
|
||||
"呼吸数据介绍".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.rpx,
|
||||
color: themeController.currentColor.sc3,
|
||||
@@ -139,7 +181,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
SizedBox(width: 15.rpx), // 圆球和文字之间的间隔
|
||||
// 文字
|
||||
Text(
|
||||
'正常范围(8~20)',
|
||||
'正常范围'.tr + "${range}",
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
AppConstants().smaller_text_fontSize, // 文字的大小
|
||||
@@ -158,6 +200,8 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
yMin: 50,
|
||||
yMax: 150,
|
||||
dataPoints: dataPoints,
|
||||
actYMax: max.toDouble(),
|
||||
actYMin: min.toDouble(),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
@@ -169,7 +213,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
"平均呼吸",
|
||||
"${avgBreath['name']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
@@ -179,14 +223,14 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
"12",
|
||||
"${avgBreath['value']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc2,
|
||||
fontSize:
|
||||
AppConstants().normal_text_fontSize),
|
||||
),
|
||||
Text(
|
||||
"次/分钟",
|
||||
"${avgBreath['unit']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
@@ -201,7 +245,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
"基准呼吸",
|
||||
"${baseBreath['name']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
@@ -213,7 +257,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
"15",
|
||||
"${baseBreath['value']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc2,
|
||||
fontSize:
|
||||
@@ -222,7 +266,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Text(
|
||||
"次/分钟",
|
||||
"${baseBreath['unit']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
@@ -239,7 +283,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
"最低呼吸",
|
||||
"${minBreath['name']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
@@ -251,7 +295,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
"11",
|
||||
"${minBreath['value']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc2,
|
||||
fontSize:
|
||||
@@ -260,7 +304,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Text(
|
||||
"次/分钟",
|
||||
"${minBreath['unit']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
@@ -277,7 +321,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
"最高呼吸",
|
||||
"${maxBreath['name']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
@@ -289,7 +333,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
"18",
|
||||
"${maxBreath['value']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc2,
|
||||
fontSize:
|
||||
@@ -298,7 +342,7 @@ class _BreatheStandardWidgetState extends State<BreatheStandardWidget> {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Text(
|
||||
"次/分钟",
|
||||
"${maxBreath['unit']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
|
||||
@@ -169,7 +169,7 @@ class _CompareSleepWidgetState extends State<CompareSleepWidget> {
|
||||
SizedBox(width: 13.rpx), // 文字和容器之间的间距
|
||||
// 文字
|
||||
Text(
|
||||
'今日数据', // 文字内容
|
||||
'今日数据'.tr, // 文字内容
|
||||
style: TextStyle(
|
||||
fontSize: 18.rpx, // 文字大小
|
||||
color:
|
||||
@@ -190,7 +190,7 @@ class _CompareSleepWidgetState extends State<CompareSleepWidget> {
|
||||
SizedBox(width: 13.rpx), // 文字和容器之间的间距
|
||||
// 文字
|
||||
Text(
|
||||
'昨日数据', // 文字内容
|
||||
'昨日数据'.tr, // 文字内容
|
||||
style: TextStyle(
|
||||
fontSize: 18.rpx, // 文字大小
|
||||
color:
|
||||
|
||||
@@ -61,7 +61,7 @@ class _DiseasePercentsWidgetState extends State<DiseasePercentsWidget> {
|
||||
// "explain": "呼吸系统是负责气体交换的器官系统,包括鼻、喉、气管和肺等。",
|
||||
// },
|
||||
// ];
|
||||
|
||||
|
||||
@override
|
||||
void setState(VoidCallback callback) {
|
||||
super.setState(callback);
|
||||
@@ -84,7 +84,7 @@ class _DiseasePercentsWidgetState extends State<DiseasePercentsWidget> {
|
||||
widget.sleepReport['cdri'].isEmpty) {
|
||||
return Container();
|
||||
}
|
||||
List diseaseData = widget.sleepReport['cdri'];
|
||||
List diseaseData = widget.sleepReport['cdri'];
|
||||
var showLabel = convertDiseaseData(diseaseData);
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
@@ -120,7 +120,7 @@ class _DiseasePercentsWidgetState extends State<DiseasePercentsWidget> {
|
||||
context,
|
||||
Container(
|
||||
child: Text(
|
||||
"慢性病风险指数介绍。",
|
||||
"慢性病风险指数介绍".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.rpx,
|
||||
color: themeController.currentColor.sc3,
|
||||
@@ -158,23 +158,24 @@ class _DiseasePercentsWidgetState extends State<DiseasePercentsWidget> {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
List<Map<String, dynamic>> convertDiseaseData(List data) {
|
||||
return data.asMap().entries.map<Map<String, dynamic>>((entry) {
|
||||
final index = entry.key;
|
||||
final item = entry.value;
|
||||
|
||||
return {
|
||||
"key": item["id"],
|
||||
"name": item["name"],
|
||||
"color": item["id"] == 40004
|
||||
? stringToColor("#FF7159") // 特殊颜色处理
|
||||
: stringToColor("#00C1AA"),
|
||||
"percent": item["value"],
|
||||
"explain": (item["tips"] != null && (item["tips"] as String).trim().isNotEmpty)
|
||||
? item["tips"]
|
||||
: '未知数据'.tr,
|
||||
};
|
||||
}).toList();
|
||||
}
|
||||
List<Map<String, dynamic>> convertDiseaseData(List data) {
|
||||
return data.asMap().entries.map<Map<String, dynamic>>((entry) {
|
||||
final index = entry.key;
|
||||
final item = entry.value;
|
||||
|
||||
return {
|
||||
"key": item["id"],
|
||||
"name": item["name"],
|
||||
"color": item["id"] == 40004
|
||||
? stringToColor("#FF7159") // 特殊颜色处理
|
||||
: stringToColor("#00C1AA"),
|
||||
"percent": item["value"],
|
||||
"explain":
|
||||
(item["tips"] != null && (item["tips"] as String).trim().isNotEmpty)
|
||||
? item["tips"]
|
||||
: '未知数据'.tr,
|
||||
};
|
||||
}).toList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class _HeartHealthWidgetState extends State<HeartHealthWidget> {
|
||||
context,
|
||||
Container(
|
||||
child: Text(
|
||||
"心理健康评估介绍。",
|
||||
"心理健康评估介绍".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.rpx,
|
||||
color: themeController.currentColor.sc3,
|
||||
|
||||
@@ -104,7 +104,7 @@ class _HeartPointWidgetState extends State<HeartPointWidget> {
|
||||
context,
|
||||
Container(
|
||||
child: Text(
|
||||
"心率散点图介绍。",
|
||||
"心率散点图介绍".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.rpx,
|
||||
color: themeController.currentColor.sc3,
|
||||
|
||||
@@ -52,6 +52,7 @@ class _HeartRateCardState extends State<HeartRateCard> {
|
||||
runSpacing: 25.rpx, // 每行之间的垂直间距
|
||||
children: List.generate(data.length, (index) {
|
||||
final item = data[index];
|
||||
item['showTip'] = true;
|
||||
return SizedBox(
|
||||
width: (MediaQuery.of(context).size.width - 160.rpx) / 3,
|
||||
child: SleepDataModuleWidget(data: item),
|
||||
|
||||
@@ -46,13 +46,52 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
final endTime = widget.sleepReport['endTime'];
|
||||
List<Map<String, dynamic>> data =
|
||||
(widget.sleepReport['hrbc'] as List).cast<Map<String, dynamic>>();
|
||||
final dataPoints = data.map((item) {
|
||||
final x = item['st'] as int;
|
||||
final y = (item['value'] as num).toDouble(); // 安全地转换为 double
|
||||
return TimeSeriesPoint(x, y);
|
||||
}).toList();
|
||||
final dataPoints = data.map((item) {
|
||||
final x = item['st'] as int;
|
||||
final y = (item['value'] as num).toDouble(); // 安全地转换为 double
|
||||
return TimeSeriesPoint(x, y);
|
||||
}).toList();
|
||||
|
||||
List<Map<String, dynamic>> hrs =
|
||||
(widget.sleepReport['hrs'] as List).cast<Map<String, dynamic>>();
|
||||
//206 平均心率
|
||||
//202 基准心率
|
||||
//207 最低心率
|
||||
//208 最高心率
|
||||
// 找 id == 206 的元素(平均心率)
|
||||
Map<String, dynamic>? avgHeartRate = hrs.firstWhere(
|
||||
(element) => element['id'] == 206,
|
||||
orElse: () => {},
|
||||
);
|
||||
|
||||
// 找 id == 202 的元素(基准心率)
|
||||
Map<String, dynamic>? baseHeartRate = hrs.firstWhere(
|
||||
(element) => element['id'] == 202,
|
||||
orElse: () => {},
|
||||
);
|
||||
|
||||
// 找 id == 207 的元素(最低心率)
|
||||
Map<String, dynamic>? minHeartRate = hrs.firstWhere(
|
||||
(element) => element['id'] == 207,
|
||||
orElse: () => {},
|
||||
);
|
||||
|
||||
// 找 id == 208 的元素(最高心率)
|
||||
Map<String, dynamic>? maxHeartRate = hrs.firstWhere(
|
||||
(element) => element['id'] == 208,
|
||||
orElse: () => {},
|
||||
);
|
||||
String range = baseHeartRate['range'] ?? '';
|
||||
int min = 0;
|
||||
int max = 0;
|
||||
|
||||
if (range.isNotEmpty && range.contains('~')) {
|
||||
List<String> parts = range.split('~');
|
||||
if (parts.length == 2) {
|
||||
min = int.tryParse(parts[0]) ?? 0;
|
||||
max = int.tryParse(parts[1]) ?? 0;
|
||||
}
|
||||
}
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
@@ -70,7 +109,7 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
"心率基准".tr,
|
||||
"心率数据".tr,
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize: AppConstants().title_text_fontSize),
|
||||
@@ -86,7 +125,7 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
context,
|
||||
Container(
|
||||
child: Text(
|
||||
"心率基准介绍".tr,
|
||||
"心率数据介绍".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.rpx,
|
||||
color: themeController.currentColor.sc3,
|
||||
@@ -133,7 +172,7 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
SizedBox(width: 15.rpx), // 圆球和文字之间的间隔
|
||||
// 文字
|
||||
Text(
|
||||
'正常范围(50~80)',
|
||||
'正常范围'.tr + "${range}",
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
AppConstants().smaller_text_fontSize, // 文字的大小
|
||||
@@ -142,6 +181,18 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
),
|
||||
],
|
||||
),
|
||||
// Container(
|
||||
// // color: Colors.red,
|
||||
// width: double.infinity,
|
||||
// // height: 300.rpx,
|
||||
// child: TimeSeriesChart(
|
||||
// startTime: startTime,
|
||||
// endTime: endTime,
|
||||
// yMin: min.toDouble(),
|
||||
// yMax: max.toDouble(),
|
||||
// dataPoints: dataPoints,
|
||||
// ),
|
||||
// ),
|
||||
Container(
|
||||
// color: Colors.red,
|
||||
width: double.infinity,
|
||||
@@ -152,6 +203,8 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
yMin: 50,
|
||||
yMax: 150,
|
||||
dataPoints: dataPoints,
|
||||
actYMin: min.toDouble(),
|
||||
actYMax: max.toDouble(),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
@@ -163,7 +216,7 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
"平均心率",
|
||||
"${avgHeartRate['name']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
@@ -173,14 +226,14 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
"89",
|
||||
"${avgHeartRate['value']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc2,
|
||||
fontSize:
|
||||
AppConstants().normal_text_fontSize),
|
||||
),
|
||||
Text(
|
||||
"次/分钟",
|
||||
"${avgHeartRate['unit']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
@@ -195,7 +248,7 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
"基准心率",
|
||||
"${baseHeartRate['name']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
@@ -207,7 +260,7 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
"80",
|
||||
"${baseHeartRate['value']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc2,
|
||||
fontSize:
|
||||
@@ -216,7 +269,7 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Text(
|
||||
"次/分钟",
|
||||
"${baseHeartRate['unit']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
@@ -233,7 +286,7 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
"最低心率",
|
||||
"${minHeartRate['name']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
@@ -245,7 +298,7 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
"68",
|
||||
"${minHeartRate['value']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc2,
|
||||
fontSize:
|
||||
@@ -254,7 +307,7 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Text(
|
||||
"次/分钟",
|
||||
"${minHeartRate['unit']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
@@ -271,7 +324,7 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
"最高心率",
|
||||
"${maxHeartRate['name']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
@@ -283,7 +336,7 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
"98",
|
||||
"${maxHeartRate['value']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc2,
|
||||
fontSize:
|
||||
@@ -292,7 +345,7 @@ class _HeartRateStandardWidgetState extends State<HeartRateStandardWidget> {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
Text(
|
||||
"次/分钟",
|
||||
"${maxHeartRate['unit']}",
|
||||
style: TextStyle(
|
||||
color: themeController.currentColor.sc3,
|
||||
fontSize:
|
||||
|
||||
@@ -92,7 +92,7 @@ class _SkinPercentWidgetState extends State<SkinPercentWidget> {
|
||||
context,
|
||||
Container(
|
||||
child: Text(
|
||||
"皮肤指数介绍。",
|
||||
"皮肤指数介绍".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.rpx,
|
||||
color: themeController.currentColor.sc3,
|
||||
|
||||
@@ -52,6 +52,7 @@ class _SleepCardState extends State<SleepCard> {
|
||||
runSpacing: 25.rpx, // 每行之间的垂直间距
|
||||
children: List.generate(data.length, (index) {
|
||||
final item = data[index];
|
||||
item['showTip'] = true;
|
||||
return SizedBox(
|
||||
width: (MediaQuery.of(context).size.width - 160.rpx) / 3,
|
||||
child: SleepDataModuleWidget(data: item),
|
||||
|
||||
@@ -67,12 +67,16 @@ class _SleepScoreWidgetState extends State<SleepScoreWidget> {
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'30天平均分'.tr,
|
||||
style: TextStyle(
|
||||
color: Color(0xFFD3D3D3),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
Container(
|
||||
constraints: BoxConstraints(maxWidth: 150.rpx),
|
||||
child: Text(
|
||||
'30天平均分'.tr,
|
||||
style: TextStyle(
|
||||
color: Color(0xFFD3D3D3),
|
||||
fontSize: 26.rpx,
|
||||
letterSpacing: 0.0,
|
||||
),
|
||||
maxLines: 1,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
|
||||
@@ -47,69 +47,13 @@ class _SleepViewWidgetState extends State<SleepViewWidget> {
|
||||
.where((item) => item['show'] != false)
|
||||
.toList();
|
||||
|
||||
// final snoreValues = generateSnoreValues(
|
||||
// widget.sleepReport['startTime'],
|
||||
// widget.sleepReport['endTime'],
|
||||
// );
|
||||
|
||||
List snoreValues = widget.sleepReport['ssp'];
|
||||
Map time = MyUtils.diffHoursMinutesMap(
|
||||
widget.sleepReport['startTime'], widget.sleepReport['endTime']);
|
||||
int hour = time['hours'];
|
||||
int minutes = time['minutes'];
|
||||
// List stages = [
|
||||
// {"et": 1748011592746, "st": 1748010870326, "type": 1},
|
||||
// {"et": 1748013519534, "st": 1748011593746, "type": 2},
|
||||
// {"et": 1748013639534, "st": 1748013520534, "type": 1},
|
||||
// {"et": 1748014183143, "st": 1748013640534, "type": 2},
|
||||
// {"et": 1748014363143, "st": 1748014184143, "type": 1},
|
||||
// {"et": 1748014423143, "st": 1748014364143, "type": 2},
|
||||
// {"et": 1748014541143, "st": 1748014424143, "type": 1},
|
||||
// {"et": 1748015439477, "st": 1748014542143, "type": 0},
|
||||
// {"et": 1748018470415, "st": 1748015440477, "type": 1},
|
||||
// {"et": 1748019755726, "st": 1748018471415, "type": 2},
|
||||
// {"et": 1748020123225, "st": 1748019756726, "type": 1},
|
||||
// {"et": 1748021138809, "st": 1748020124225, "type": 2},
|
||||
// {"et": 1748021535809, "st": 1748021139809, "type": 1},
|
||||
// {"et": 1748021776809, "st": 1748021536809, "type": 2},
|
||||
// {"et": 1748022140117, "st": 1748021777809, "type": 1},
|
||||
// {"et": 1748022320117, "st": 1748022141117, "type": 2},
|
||||
// {"et": 1748022996627, "st": 1748022321117, "type": 1},
|
||||
// {"et": 1748023439627, "st": 1748022997627, "type": 2},
|
||||
// {"et": 1748023812173, "st": 1748023440627, "type": 1},
|
||||
// {"et": 1748023895173, "st": 1748023813173, "type": 2},
|
||||
// {"et": 1748024692483, "st": 1748023896173, "type": 1},
|
||||
// {"et": 1748024960483, "st": 1748024693483, "type": 2},
|
||||
// {"et": 1748025678983, "st": 1748024961483, "type": 1},
|
||||
// {"et": 1748026351585, "st": 1748025679983, "type": 2},
|
||||
// {"et": 1748027131585, "st": 1748026352585, "type": 1},
|
||||
// {"et": 1748027209585, "st": 1748027132585, "type": 2},
|
||||
// {"et": 1748027487864, "st": 1748027210585, "type": 1},
|
||||
// {"et": 1748027967864, "st": 1748027488864, "type": 3},
|
||||
// {"et": 1748028182371, "st": 1748027968864, "type": 1},
|
||||
// {"et": 1748028372371, "st": 1748028183371, "type": 2},
|
||||
// {"et": 1748029109981, "st": 1748028373371, "type": 1},
|
||||
// {"et": 1748029958223, "st": 1748029110981, "type": 2},
|
||||
// {"et": 1748030792223, "st": 1748029959223, "type": 1},
|
||||
// {"et": 1748030874723, "st": 1748030793223, "type": 2},
|
||||
// {"et": 1748032042305, "st": 1748030875723, "type": 1},
|
||||
// {"et": 1748032170305, "st": 1748032043305, "type": 2},
|
||||
// {"et": 1748033387611, "st": 1748032171305, "type": 1},
|
||||
// {"et": 1748033967118, "st": 1748033388611, "type": 2},
|
||||
// {"et": 1748034087118, "st": 1748033968118, "type": 1},
|
||||
// {"et": 1748034147118, "st": 1748034088118, "type": 2},
|
||||
// {"et": 1748034327118, "st": 1748034148118, "type": 1},
|
||||
// {"et": 1748034930672, "st": 1748034328118, "type": 2},
|
||||
// {"et": 1748035230672, "st": 1748034931672, "type": 1},
|
||||
// {"et": 1748035353974, "st": 1748035231672, "type": 2},
|
||||
// {"et": 1748036710471, "st": 1748035354974, "type": 1},
|
||||
// {"et": 1748037126471, "st": 1748036711471, "type": 2},
|
||||
// {"et": 1748037310051, "st": 1748037127471, "type": 1},
|
||||
// {"et": 1748037380051, "st": 1748037311051, "type": 2},
|
||||
// {"et": 1748038881358, "st": 1748037381051, "type": 1},
|
||||
// {"et": 1748038962867, "st": 1748038882358, "type": 0},
|
||||
// {"et": 1748039291867, "st": 1748038963867, "type": 1},
|
||||
// {"et": 1748039684867, "st": 1748039292867, "type": 0}
|
||||
// ];
|
||||
|
||||
List stages = widget.sleepReport['sleepData']['stages'];
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
|
||||
@@ -43,6 +43,10 @@ class _SnoreViewWidgetWidgetState extends State<SnoreViewWidgetWidget> {
|
||||
List<Map<String, dynamic>> data =
|
||||
(widget.sleepReport['ssp'] as List).cast<Map<String, dynamic>>();
|
||||
List<Map<String, dynamic>> showLabel = convertToShowLabel(data);
|
||||
// List<Map<String, dynamic>> showLabel = [
|
||||
// // {'startTime': 1748275800344, "endTime": 1748283000000, "times": 4},
|
||||
// {'startTime': 1748293800000, "endTime": 1748294400000, "times": 7},
|
||||
// ];
|
||||
var startTime = widget.sleepReport['startTime'];
|
||||
var endTime = widget.sleepReport['endTime'];
|
||||
return Container(
|
||||
@@ -105,9 +109,18 @@ class _SnoreViewWidgetWidgetState extends State<SnoreViewWidgetWidget> {
|
||||
SizedBox(
|
||||
height: 32.rpx,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
"次".tr,
|
||||
style: TextStyle(
|
||||
color: stringToColor("#FFFFFF"), fontSize: 18.rpx),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsetsDirectional.fromSTEB(0.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||
EdgeInsetsDirectional.fromSTEB(0.rpx, 40.rpx, 0.rpx, 0.rpx),
|
||||
child: LineChartByRange(
|
||||
showLabel: showLabel,
|
||||
startTime: startTime,
|
||||
@@ -132,13 +145,14 @@ class _SnoreViewWidgetWidgetState extends State<SnoreViewWidgetWidget> {
|
||||
List<Map<String, dynamic>> result = [];
|
||||
|
||||
int startTime = data[0]['st'];
|
||||
int endTime = data[0]['st'];
|
||||
int endTime = data[0]['et'];
|
||||
int currentValue = data[0]['value'];
|
||||
|
||||
for (int i = 1; i < data.length; i++) {
|
||||
final item = data[i];
|
||||
final st = item['st'];
|
||||
final value = item['value'];
|
||||
final et = item['et'];
|
||||
|
||||
if (value == currentValue) {
|
||||
endTime = st;
|
||||
@@ -149,7 +163,7 @@ class _SnoreViewWidgetWidgetState extends State<SnoreViewWidgetWidget> {
|
||||
"times": currentValue,
|
||||
});
|
||||
startTime = st;
|
||||
endTime = st;
|
||||
endTime = et;
|
||||
currentValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ class _ZiZhuShenJingPercentWidgetState
|
||||
context,
|
||||
Container(
|
||||
child: Text(
|
||||
"自主神经平衡指数监测介绍。",
|
||||
"自主神经平衡指数监测介绍".tr,
|
||||
style: TextStyle(
|
||||
fontSize: 26.rpx,
|
||||
color: themeController.currentColor.sc3,
|
||||
|
||||
Reference in New Issue
Block a user