更新睡眠报告
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user