更新睡眠报告
This commit is contained in:
@@ -9,7 +9,8 @@ import 'package:vbvs_app/pages/device_bind/componnet/bind_dialog.dart';
|
||||
import 'package:vbvs_app/pages/sleep_report/chart/AdviceComponnetWidget.dart';
|
||||
|
||||
class AIAdviceWidget extends StatefulWidget {
|
||||
AIAdviceWidget({super.key});
|
||||
var sleepReport;
|
||||
AIAdviceWidget({super.key, required this.sleepReport});
|
||||
|
||||
@override
|
||||
State<AIAdviceWidget> createState() => _AIAdviceWidgetState();
|
||||
@@ -33,32 +34,12 @@ class _AIAdviceWidgetState extends State<AIAdviceWidget> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List advices = [
|
||||
{
|
||||
"title": "调整作息时间",
|
||||
"description": "确保每天在相同的时间上床并醒来。保持规律的作息可以帮助调整你的生物钟,改善睡眠质量。",
|
||||
},
|
||||
{
|
||||
"title": "减少睡前刺激",
|
||||
"description": "避免在睡前使用电子设备,如手机、电脑等,减少屏幕时间,以防影响你的睡眠质量。",
|
||||
},
|
||||
{
|
||||
"title": "创造理想睡眠环境",
|
||||
"description": "确保卧室安静、黑暗且舒适。调节室温,并避免过于嘈杂或明亮的环境,帮助你快速入睡。",
|
||||
},
|
||||
{
|
||||
"title": "避免摄入咖啡因和酒精",
|
||||
"description": "避免在睡前几小时内摄入咖啡、茶、酒精等饮品,因为这些物质可能会干扰你的睡眠。",
|
||||
},
|
||||
{
|
||||
"title": "增加日间活动",
|
||||
"description": "适量的日间运动可以帮助提高睡眠质量,但要避免睡前剧烈运动,以免影响入睡。",
|
||||
},
|
||||
{
|
||||
"title": "放松身心",
|
||||
"description": "睡前可以进行一些放松活动,如深呼吸、冥想或听轻音乐,这有助于减轻压力并促进良好的睡眠。",
|
||||
},
|
||||
];
|
||||
if (widget.sleepReport == null ||
|
||||
widget.sleepReport['sugges'] == null ||
|
||||
widget.sleepReport['sugges'].isEmpty) {
|
||||
return Container();
|
||||
}
|
||||
List advices = widget.sleepReport['sugges'];
|
||||
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
@@ -126,8 +107,8 @@ class _AIAdviceWidgetState extends State<AIAdviceWidget> {
|
||||
child: Column(
|
||||
children: advices.map<Widget>((advice) {
|
||||
return AdviceComponnetWidget(
|
||||
title: advice["title"],
|
||||
description: advice["description"],
|
||||
title: advice["q"],
|
||||
description: advice["s"],
|
||||
).paddingOnly(bottom: 0.rpx); // 在每个组件下方添加间隔
|
||||
}).toList(),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user