更新睡眠报告
This commit is contained in:
@@ -7,12 +7,11 @@ 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/pages/device_bind/componnet/bind_dialog.dart';
|
||||
import 'package:vbvs_app/pages/sleep_report/chart/AdviceComponnetWidget.dart';
|
||||
import 'package:vbvs_app/pages/sleep_report/chart/RadarChart.dart';
|
||||
import 'package:vbvs_app/pages/sleep_report/chart/SleepRadarChart.dart';
|
||||
|
||||
class CompareSleepWidget extends StatefulWidget {
|
||||
CompareSleepWidget({super.key});
|
||||
var sleepReport;
|
||||
CompareSleepWidget({super.key, required this.sleepReport});
|
||||
|
||||
@override
|
||||
State<CompareSleepWidget> createState() => _CompareSleepWidgetState();
|
||||
@@ -36,20 +35,37 @@ class _CompareSleepWidgetState extends State<CompareSleepWidget> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var today = {
|
||||
"type1": 40.0,
|
||||
"type2": 80.0,
|
||||
"type3": 60.0,
|
||||
"type4": 70.0,
|
||||
"type5": 100.0
|
||||
};
|
||||
var yesterday = {
|
||||
"type1": 40.0,
|
||||
"type2": 90.0,
|
||||
"type3": 50.0,
|
||||
"type4": 70.0,
|
||||
"type5": 30.0
|
||||
};
|
||||
if (widget.sleepReport == null ||
|
||||
widget.sleepReport['yc'] == null ||
|
||||
widget.sleepReport['yc'].isEmpty) {
|
||||
return Container();
|
||||
}
|
||||
List<Map<String, dynamic>> data = (widget.sleepReport['yc'] as List)
|
||||
.map((e) => e as Map<String, dynamic>)
|
||||
.toList();
|
||||
|
||||
// var today = {
|
||||
// "type1": 40.0,
|
||||
// "type2": 80.0,
|
||||
// "type3": 60.0,
|
||||
// "type4": 70.0,
|
||||
// "type5": 100.0
|
||||
// };
|
||||
// var yesterday = {
|
||||
// "type1": 40.0,
|
||||
// "type2": 90.0,
|
||||
// "type3": 50.0,
|
||||
// "type4": 70.0,
|
||||
// "type5": 30.0
|
||||
// };
|
||||
Map<String, double> today = {};
|
||||
Map<String, double> yesterday = {};
|
||||
|
||||
for (var item in data) {
|
||||
String typeKey = 'type${item['id']}';
|
||||
today[typeKey] = (item['t'] as num).toDouble();
|
||||
yesterday[typeKey] = (item['y'] as num).toDouble();
|
||||
}
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
@@ -128,8 +144,9 @@ class _CompareSleepWidgetState extends State<CompareSleepWidget> {
|
||||
padding: EdgeInsetsDirectional.fromSTEB(
|
||||
30.rpx, 0.rpx, 0.rpx, 0.rpx),
|
||||
child: SleepRadarChart(
|
||||
today: today,
|
||||
yesterday: yesterday,
|
||||
// today: today,
|
||||
// yesterday: yesterday,
|
||||
data: data,
|
||||
),
|
||||
),
|
||||
// 在左侧添加一个 Text
|
||||
|
||||
Reference in New Issue
Block a user